Skip to content
Prev 69119 / 398502 Next

selections of data by one variable

Tu Yu-Kang wrote:

            
Which language is this???

To summarize, all the code you specified is:

a<-c(1:10) & b<-c(11:20)
f<-d[d$b==17]
b==e<-c(13,15,17)

In R, each line for itself is syntacically completely incorrect (even if
you say something would work, which is definitely not the case)!
"PLEASE do read the posting guide!"

I guess you want something like

 d <- data.frame(a = 1:10, b = 11:20)
 subset(d, b == 17)
 e <- c(13, 15, 17)
 subset(d, b %in% e)

Uwe Ligges