Professional Documents
Culture Documents
rbind(1:3,1:3)
cbind(m, c(10,11))
#Array Subsetting
#get the element in the first row, third column, third matrix
mn[1,3,3]
mn["r1","c3","m3"]
#get the second column in the second matrix, check if the result is an array
mn[,2,2]
is.array(mn[,2,2])
#use drop=FALSE to ensure the result is an array
mn[,2,2,drop=FALSE]
is.array(mn[,2,2,drop=F])
#access only the second matrix
mn[,,"m2"]
#----------------
#Factors - Categorical data
bloodgroup<- c("A",'B','O','AB','AB','O','A')
BG<- factor(bloodgroup,levels=c("B","O","AB","A"), labels=c("BG_B",
"BG_O","BG_AB","BG_A"))
BG[1]<BG[2]
BG[2]<BG[1]