type ??functionname
N X P matriced data; N row and P colum, N observations with P variables
if you type c("something","Hello") it generates the Char values
Just like logical function of MATLAB, it can substract the subset from the dataset and make it into specific(another) dataset subset
R specifies the capital letters different from the lower letters
Getwd(); get working directory file that we are using setwd(); set the directory addresses
"<-" and "=" is little different, "<-" is preferred since the "=" has multiple meanings.(e.g. maybe logical equations?)
To use the package, firstly,install it by using command install.packages("psych") And load the package into working environment by library(psych)
".csv" files are commonly used. It's short for "comma seperated values" files.
e.g. spreadsheets, Google Sheets, Microsoft Excel etc....
Give the data frames a useul name e.g. data1, RegDat1 ...
dat1<-read.csv(file="filename.csv", header=T, stringsAsFactors = F)
in here, the header means whether you want to take the very first row to the variable names(True, T) or not (False, F)
Also, if you want to treat the categorical variables(e.g. Gender(female, male)) as the binomial, you can set it by stringsAsFactors = True(or T)
d[10,23]
It indexes the date element in 10th colum and 23rd row
colnames(dat1)[1] <- "something_you_want_to_use_it_as_variablename"
() specifies dataset and []_ specifies which column you want to change it to specific variable name
summary(dat1) : getting the basic descriptives from data file "dat1" View(dat1) : it makes able to read data file "dat1" in FANCY data frame on console. ( if you just type dat1 in console, it literally will Print dat1 on console colnames(dat1)[1] or dat1$State, you can index the the 1st column of data file dat1 or Varialbe named State in data file dat1
If we want to deselect, get rid of certain variables from dat1, we can use variable methods. Two are basics. dat1_modified <- cbind(dat1[,1:7], dat1[,11:18]) dat1_modified1 <- rbind(dat1[1:7,], dat1[11:18,]) OR Use codes like belows, dat1_modified2 <- dat1[,-8:-10] dat_modified3 <- dat1[-8:-10,]
corr_matrix$Call :If you type it you can see what you've did to the corr_matrix and track the changes or variables you are using
scale(datafile[
t.test(d[,], d[,]), Usually it require datasets to be kind of in line to each other(maybe dimensions?) OR Other ways to do it with using variables neames t.test(d$QualityOfLife[1:25], d$QualityOfLife[26:50])
anova(X,Y) , you can put even models in X and Y
interact_plot(model_5, pred=Neuroticism, modx=Extraversion) use the variables from interaction of interest high E and N is associated with high unemployment; high E and low N is associated with low unemployment N is not related to unemployment when E is low we can plot it with Neuroticism as the moderator too. Theory must lead the way here