How to omit rows with NA in only two columns in R?

后端 未结 4 1083
梦谈多话
梦谈多话 2021-02-04 10:39

I want to omit rows where NA appears in both of two columns.

I\'m familiar with na.omit, is.na, and compl

4条回答
  •  温柔的废话
    2021-02-04 11:20

    dplyr solution

    require("dplyr")
    df %>% filter_at(.vars = vars(x, y), .vars_predicate = any_vars(!is.na(.)))
    

    can be modified to take any number columns using the .vars argument

提交回复
热议问题