Simone Gabbriellini
2008-Nov-30 20:36 UTC
[R] how to select cases based on value of one or more variables
dear list, I have read a spss file with read.spss() now I have a list with all my variable stored as vectors. is it possible to selec cases based on the value of one or more variables? thank you, Simone
David Winsemius
2008-Nov-30 20:47 UTC
[R] how to select cases based on value of one or more variables
?subset On Nov 30, 2008, at 3:36 PM, Simone Gabbriellini wrote:> dear list, > > I have read a spss file with read.spss() > > now I have a list with all my variable stored as vectors. > > is it possible to selec cases based on the value of one or more > variables? > > thank you, > Simone > > ______________________________________________ > R-help at 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.
Don MacQueen
2008-Nov-30 20:49 UTC
[R] how to select cases based on value of one or more variables
It is. For example, if you have a variable stored as a vector named "x", and another variable stored as aa vector named "y", you can select cases of y where x is greater than 3 by using y[x>3] However, you're going to have to provide more information in order to get a better answer than that (see the posting guide, link included with every post to r-help). In particular, I'm guessing that the answer you really want looks somewhat different than my example -- but this depends on the exact structure of what read.spss() produces. I'd also suggest reading some of the documentation available from the R website (CRAN), notably, "An Introduction to R". -Don At 9:36 PM +0100 11/30/08, Simone Gabbriellini wrote:>dear list, > >I have read a spss file with read.spss() > >now I have a list with all my variable stored as vectors. > >is it possible to selec cases based on the value of one or more variables? > >thank you, >Simone > >______________________________________________ >R-help at 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.-- --------------------------------- Don MacQueen Lawrence Livermore National Laboratory Livermore, CA, USA 925-423-1062 macq at llnl.gov