简体   繁体   中英

Filter data.frame using sqldf and/or dplyr in R

I need to find null values inside a data.frame using sqldf or dplyr libraries.

I know that I can use na.omit() to do that, but I cant find the way to do the same using sqldf or dplyr libraries.

Does anyone know how to do that?

Thank you

drop_na from tidyr will drop all rows that contain missing values in any column (or in columns that you specify).

Here's the example from the documentation :

library(dplyr)
df <- tibble(x = c(1, 2, NA), y = c("a", NA, "b"))
df %>% drop_na()
#> # A tibble: 1 x 2
#>       x y    
#>   <dbl> <chr>
#> 1     1 a    
df %>% drop_na(x)
#> # A tibble: 2 x 2
#>       x y    
#>   <dbl> <chr>
#> 1     1 a    
#> 2     2 NA  

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM