Say i have the following data
B <- (5:20)
C <- (6:21)
D <- (7:22)
E <- (8:23)
data <- data.frame(B,C,D,E)
and I also have a matrix of
id <- c(4,7,9,12,15)
where this matrix represents the row identities I want to output into a new data.frame
How can one use the subset
function to subset the original data
new <- subset(data, .....)
so that new only consists of the 5 observations
subset
. It's as simple asdata[id,]
. Studyhelp("[")
. – Rolandid
is not a matrix, it is a vector – Cath