I'm stuck with a really easy task and hope someone could help me with it..
I'd like to make a new (sub)vector from an existing vector, based on 1 level of a factor. Example:
v = c(1,2,3,4,5,6,7,8,9,10)
f = factor(rep(c("Drug","Placebo"),5))
I want to make a new vector from v, containing only "Drug" or "Placebo". Resulting in:
vDrug = 1,3,5,7,9
vPlacebo = 2,4,6,8,10
Thanks in advance!