Factor,Dataframe,Array

an anonymous user · January 23, 2021 · R
v=c("Spring","Autum","Winter","Summer","Spring","Autum")
print(factor(v))
# levels is categorize
nlevels(factor(v))

# Arrays

array(c(1,2,3),dim=c(3,3,3)) # here in dim(dimension), (3,3,3) 1st - row,2nd-column,3rd- 3 matrix
array(c(1,2,3),dim=c(3,2,3))
array(c(1,2,3),dim=c(3,3))  array(c(1,2,3),dim=c(3,2)) 

array(c(1,2,3,4,5,6,7,8,9),dim=c(3,3))
array(c(1,2,3,4,5,6),dim=c(3,2))

s=c(“cricket”,’football’,”kabaddi”,”tennis”,”hockey )
fan=c(90,75,66,50,68)
data.frame(s,fan)

Comments

Please sign up or log in to contribute to the discussion.