R in action -- 2.2 数据结构
R in action -- 2.1 数据结构
1、因子及因子的使用
2、列表是若干对象的有序集合
> g <- "My First List" > h <- c(25,26,18,39) > j <- matrix(1:10, nrow = 5) > k <- c("one","two","threee") > mylist <- list(title=g,ages=h,j,k) > mylist $title [1] "My First List" $ages [1] 25 26 18 39 [[3]] [,1] [,2] [1,] 1 6 [2,] 2 7 [3,] 3 8 [4,] 4 9 [5,] 5 10 [[4]] [1] "one" "two" "threee" > mylist[2] $ages [1] 25 26 18 39 > mylist[["ages"]] [1] 25 26 18 39 > mylist[[2]] [1] 25 26 18 39 > mylist["ages"] $ages [1] 25 26 18 39