数据描述
数据来源是我编写的R包learnasreml中的fm数据集。...0.372 271
6 80026 1 0.359 0.450 258
r$> names(d1) = c("ID","F1","y1","y2","y3")
r$> head(d1)
结果...还要使用select进一步的提取:
4. tidyverse的select函数
如果使用select函数,一行代码就可以搞定:
a1 = fm %>% select(ID=TreeID, F1 = Rep..., y1 = dj, y2 = dm, y3 = h3)
5. select函数注意事项
「常见的坑:」
❝注意,MASS包中也有select函数,而且优先级更高,如果你载入了MASS包,select...5.2 放到环境变量中
「推荐的方法:」
r$> select = dplyr::select
r$> a3 = a2 %>% select(ID,F1,y1,y2,y3)
推荐在载入包时,将下面代码放在开头