i have df
id <- c(101,102,103,104) status <- c('p','f_avg','f_sig',na) df <- data.frame(id,status) i trying filter failed ones , return both pass , na not able so. know it's basic question please bear me , me out.
i tried following
df1 <- sqldf("select * df status not 'f%'") and returns 1 observation , row1 'p' need row4 'na'.
df1 <- sqldf("select * df (status not 'f%' or status null)") output:
id status 1 101 p 2 104 <na> using dplyr:
library(dplyr) filter(df, !grepl("^f", status))
Comments
Post a Comment