Displaying 1 result from an estimated 1 matches for "nih2009".
Did you mean:
nch20909
2010 Jun 22
1
subset dataset using factor levels instead of factor names
Hi All,
I have a factor variable with 52 levels -with long, annoying names. I want to keep only rows with some variables. I can do this using this code:
test1 <- subset(nih2009,ic_name %in% c('NATIONAL EYE INSTITUTE','Veterans Affairs'))
dim(test1)
[1] 2396 38
But this doesn't work:
t1 <- subset(nih2009, ic_name %in% c(27,51))
dim(t1)
[1] 0 38
I know there's a way to do this. Any help? Thanks,
Rachel
[[alternative HTML version delet...