dplyr filter on a vector rather than a dataframe in R

后端 未结 3 649
傲寒
傲寒 2021-02-08 14:57

This seems like a simple question, but I have not come across a clean solution for it yet. I have a vector in R and I want to remove certain elements from the vector, however I

3条回答
  •  庸人自扰
    2021-02-08 15:24

    You may like to try magrittr::extract. e.g.

    > library(magrittr)
    
    > c("A", "B", "C", "D") %>% extract(.!="A")
    [1] "B" "C" "D"
    

    For more extract-like functions load magrittr package and type ?alises.

提交回复
热议问题