Hi,
May be this helps.
set.seed(29)
GLSS<- data.frame(hhid=sample(1:10,30,replace=TRUE),value=rnorm(30))
IDstoSelect<- c(1,5,7)
?GLSS[!is.na(match(GLSS[,1],IDstoSelect)),]
#?? hhid?????? value
#1???? 1 -0.34216061
#6???? 1? 0.28240263
#14??? 7? 0.04197496
#17??? 7? 0.15005878
#21??? 7 -1.18640939
#22??? 7 -0.68378601
#25??? 7 -2.43423380
#27??? 5? 0.95672044
#29??? 7? 1.76127732
#or
?GLSS[GLSS[,1]%in% IDstoSelect,]
#?? hhid?????? value
#1???? 1 -0.34216061
#6???? 1? 0.28240263
#14??? 7? 0.04197496
#17??? 7? 0.15005878
#21??? 7 -1.18640939
#22??? 7 -0.68378601
#25??? 7 -2.43423380
#27??? 5? 0.95672044
#29??? 7? 1.76127732
A.K.
Hello,
i have a dataset GLSS in which one of the variables is household
id (GLSS$hhid). Now i have a variable selecting which households i want
to use in a subset (glss1H1). How do I select in an easy way the
household id's that need to go to my subset?
Would be great if someone can give me a help. Thanks!