search for: keepid

Displaying 1 result from an estimated 1 matches for "keepid".

Did you mean: keeped
2012 Jan 12
1
Keep rows where a variable matches one item of a vector
How do I subset data to only keep those rows of a dataframe where a variable's value matches one item of a vector. For example, how do I keep all of the rows (and all variables) where mydata$id equals one of the values in keepid? See below? mydata <- NULL mydata$id <- 1:30 mydata$value <- seq(from=1,to=100, length.out=30) keepid <- c(6,10,12,13,19,25,26,27,28,29) In other words, I want the output file to have two columns, 1) id and 2) value, with only those rows where id equals one of the values in the keepi...