Deleting multiple columns in different data sets in R

前端 未结 3 2011
一向
一向 2021-01-20 04:04

I\'m wondering if there is a good way to delete multiple columns over a few different data sets in R. I have a data set that looks like:

RangeNumber    Time         


        
3条回答
  •  一生所求
    2021-01-20 04:30

    Rather than delete, just choose the columns that you want, i.e.

    data1 = data1[, c(2, 3)]
    

    The question still remains about your other data sets: data2, etc. I suspect that since your data frames are all "similar", you could combine them into a single data frame with an additional identifier column, id, which tells you the data set number. How you combine your data sets depends on how you data is stored. But typically, a for loop over read.csv is the way to go.

提交回复
热议问题