try this: > 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(textConnection(lines), header=TRUE) > > closeAllConnections() > subset(DF, (ptcl5 == '.') & (variable %in% c('a', 'm'))) lo ptcl5 ptcl99 variable 1 430 . 8787 a 8 432 . 7377 m > >
On Fri, Sep 25, 2009 at 4:42 AM, premmad <mtechp...@gmail.com> wrote: > > 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. > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.