Skip to content

Instantly share code, notes, and snippets.

@adini121
adini121 / Useful_mysql_commands.md
Last active February 3, 2016 07:01
Useful mysql commands

##(My)sql commands I encountered throughout my sql-experience

####Basics #####Create database and tables

DROP DATABASE IF EXISTS database_name;

CREATE DATABASE database_name DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
@adini121
adini121 / explore-correlations.r
Created February 18, 2016 16:05 — forked from stephenturner/explore-correlations.r
Exploring correlations with R using cor.prob and chart.Correlation
## Correlation matrix with p-values. See http://goo.gl/nahmV for documentation of this function
cor.prob <- function (X, dfr = nrow(X) - 2) {
R <- cor(X, use="pairwise.complete.obs")
above <- row(R) < col(R)
r2 <- R[above]^2
Fstat <- r2 * dfr/(1 - r2)
R[above] <- 1 - pf(Fstat, 1, dfr)
R[row(R) == col(R)] <- NA
R
}
library(lars) #load lars library
# load data from csv file
fullData <- read.csv('/Users/adityanisal/Dropbox/ExtractedResultFiles/CSV/fireplace-mv1.csv')
# display data
fullData
# remove "null" columns (columns with all 0s)
M <- fullData[,colSums(fullData^2) !=0]
M
# Take all columns (features) except the last solutionVector
x <- M[,c(1:8)]