Select column 2 to last column in R

时光毁灭记忆、已成空白 提交于 2019-12-04 03:54:09

I think it's better to focus on wanting to get rid of one column of data and not wanting to select every other column. You can do this as @Arun suggested:

olddata[,-1]

Or:

olddata$ColNameToDelete <- NULL

You can get the last column with ncol():

 newdata <- olddata[,2:ncol(olddata)]
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!