Selecting a subset of columns in a data.table

前端 未结 4 1629
遇见更好的自我
遇见更好的自我 2020-12-01 09:15

I\'d like to print all the columns of a data table dt except one of them named V3 but don\'t want to refer to it by number but by name. This is the

4条回答
  •  忘掉有多难
    2020-12-01 09:52

    From version 1.12.0 onwards, it is also possible to select columns using regular expressions on their names:

    iris_DT <- as.data.table(iris)
    
    iris_DT[, .SD, .SDcols = patterns(".e.al")]
    

提交回复
热议问题