#数据框
> df <- data.frame(id=c(1,2,3,4),name=c("a","b","c","d"),gender=c(TRUE,TRUE,FALSE,FALSE)) > nrow(df) #4行 [1] 4
> ncol(df) #3列 [1] 3
> df2 <- data.frame(id=c(1,2,3,4),score=c(80,86,90,100)) > df2 id score 1 1 80 2 2 86 3 3 90 4 4 100
> data.matrix(df2) id score [1,] 1 80 [2,] 2 86 [3,] 3 90 [4,] 4 100