首页 > 其他 > 详细

R根据列名提取想要的列

时间:2019-06-26 15:39:16      阅读:913      评论:0      收藏:0      [点我收藏+]
  • 数据格式如下:
a    b    c    d    e
1    2    3    4    5
  • 使用select过滤不要的列
df[,-which(names(df)%in%c("a","b")]
subset(df,select=-c(a,b))
  • 使用select选择想要的列
df[ , c("x","y")]
subset(df, select=c(x,y))

R根据列名提取想要的列

原文:https://www.cnblogs.com/raisok/p/11089646.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!