- 數據格式如下:
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))
a b c d e
1 2 3 4 5
df[,-which(names(df)%in%c("a","b")]
subset(df,select=-c(a,b))
df[ , c("x","y")]
subset(df, select=c(x,y))
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。