#If some code does not work, we need to figure out if it is because some library is not loaded. Like filter, we need dplyr library to be loaded first.
library(dplyr)
T<-filter(P_HMD_TEST_PRED,Tabc==1)
# we usually using conditions like this A<-filter(data, EE==1 & EE==2), how about we do not want the logic of and, we want or. ‘|’ is the solution. How about not equal to 1? We used !() as a solution. Please see the example.
# filter out records with EE as 1 OR 0 from data.
A<-filter(data,EE==1 | EE==0)
# filter our records with AAAA not equal to 0, and AAAA not equal to 1 as well.
AA<-filter(data,!(AAAA %in% c(0,1)))
nrow(A)
save(A,file=”A.Rdata”)
colnames(AAAA)
sapply(AAAA, mode)
#correlation
cor(matrix, use=”pairwise.complete.obs”)
cor(data, use=”complete.obs”, method=”kendall”)
cov(data, use=”complete.obs”)
#check sum of each veriable and how many unique value in each variable. Sapply is a great function.
sapply(data,function(x) sum(is.na(x)))
sapply(data, function(x) length(unique(x)))