[R] look up and Missing

John Kane jrkrideau at yahoo.ca
Sun Nov 8 17:17:02 CET 2009


I'm not quite sure I understood the second queston but does this work?

subset(temp, xx$v2==-9)

subset(temp, xx$v2!= -9)

--- On Sun, 11/8/09, Ashta <sewashm at gmail.com> wrote:

> From: Ashta <sewashm at gmail.com>
> Subject: [R] look up and Missing
> To: r-help at stat.math.ethz.ch
> Received: Sunday, November 8, 2009, 10:23 AM
> HI  R-Users
> 
> Assume that I have a data frame 'temp' with several
> variables (v1,v2,v3,v4,v5.).
> 
>   v1 v2 v3  v4 v5
>    1 
> 2   3   3    6
>    5  2  4    2 
>   0
>    2
> -9   5   4    3
>    6 
> 2   1   3    4
> 
> 1, I want to look at the entire row values of when v2 =-9
>    like
>          2
> -9   5   4    3
> 
> I wrote
> K<- list(if(temp$v2)==-9))
> 
> I wrote the like this but  it gave me  which is
> not correct.
>    False false false false false
> 
> 2. I want assign that values  as missing
> if   v2 = -9.  (ie., I want
> exclude from the analysis
> 
> How do I do it  in R?
> 
> Thanks in advance
> 
> ______________________________________________
> 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.
> 


      __________________________________________________________________
Yahoo! Canada Toolbar: Search from anywhere on the web, and bookmark your favourite sites. Download it now
http://ca.toolbar.yahoo.com.




More information about the R-help mailing list