Hi my data set looks like this
id <- c(1,1,2,2,3,3,4,4,5,5) amt <- c(250,NA,750,NA,750,NA,500,NA,750,NA) dv <- c(NA,1,NA,2,NA,1,NA,5,NA,4) df <- data.frame(id,amt,dv)
Each ID has two rows. now i want to select the subjects whose amt == 750.
filter(df,amt == 750)
above code gives me the result, but it gives only one row for each id which have amt==750.
i want have both the rows of the id which has amt==750 ( second row of amt of that id will be NA)