[R] Nested select

premmad mtechprem at gmail.com
Fri Sep 25 10:42:13 CEST 2009


my data :

library(doBy)

lines<-"lo ptcl5 ptcl99 variable 
 430        .             8787        a
430       342        2343         m
 430        .             89            mr
431        456        4774        a
431         299       2777        m
 431        99            96          mr
 432        333         3433       a
 432         .            7377        m
 432        .             676          mr 
 "
DF <- read.table(con<- textConnection(Lines), skip = 1)

close(con) 

what i want is select lo when ptcl5 is missing and variable is either a or m
.
I tried the following query 
sqldf("select lo from DF where lo=(select lo where ptcl5='.' and
variable='m') or lo=(select lo where ptcl5='.' and variable='a')").
But I'm getting entire data instead of limited by the condition.
Is my query right please help me in this.
-- 
View this message in context: http://www.nabble.com/Nested-select-tp25608506p25608506.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list