how to remove multiple columns in r dataframe?

后端 未结 5 419
失恋的感觉
失恋的感觉 2020-12-25 13:12

I am trying to remove some columns in a dataframe. I want to know why it worked for a single column but not with multible columns e.g. this works

album2[,5]         


        
5条回答
  •  醉梦人生
    2020-12-25 13:56

    If you only want to remove columns 5 and 7 but not 6 try:

    album2 <- album2[,-c(5,7)] #deletes columns 5 and 7
    

提交回复
热议问题