R data.table join with inequality conditions

后端 未结 2 2220
南笙
南笙 2021-02-08 06:47

I would like to subset my data based on multiple inequality conditions using the data.table package. The examples in the data.table manual show how to do this with character va

2条回答
  •  再見小時候
    2021-02-08 07:21

    The solution is quite fast and straightforward using the package dplyr.

    install.packages(dplyr)
    library(dplyr)
    
    newdata <- filter(data, X > 0 , Y > 0 , Z > 0)
    

    dplyr is showing to be one of the easiest and fastest packages for managing data frames. Check this great tutorial here: http://cran.rstudio.com/web/packages/dplyr/vignettes/introduction.html

    The RStudio team have alsoe produced a nice Cheat Sheet, here: http://www.rstudio.com/resources/cheatsheets/

提交回复
热议问题