[R] Why doesn't this work ?

Iain Gallagher iaingallagher at btopenworld.com
Thu Mar 17 10:05:10 CET 2011


The first line of this reply is a definite candidate for the fortunes package!

best

i

--- On Thu, 17/3/11, Bill.Venables at csiro.au <Bill.Venables at csiro.au> wrote:

> From: Bill.Venables at csiro.au <Bill.Venables at csiro.au>
> Subject: Re: [R] Why doesn't this work ?
> To: ericstrom at aol.com, r-help at r-project.org
> Date: Thursday, 17 March, 2011, 3:54
> It doesn't work (in R) because it is
> not written in R.  It's written in some other language
> that looks a bit like R.
> 
> > t <- 3
> > z <- t %in% 1:3
> > z
> [1] TRUE
> > t <- 4
> > z <- t %in% 1:3
> > z
> [1] FALSE
> > 
> 
>  
> 
> -----Original Message-----
> From: r-help-bounces at r-project.org
> [mailto:r-help-bounces at r-project.org]
> On Behalf Of eric
> Sent: Thursday, 17 March 2011 1:26 PM
> To: r-help at r-project.org
> Subject: [R] Why doesn't this work ?
> 
> Why doesn't this work and is there a better way ?
> 
> z <-ifelse(t==1 || 2 || 3, 1,0)
> t <-3
> z
> [1] 1
> t <-4
> z
> [1] 1
> 
> trying to say ...if t == 1 or if t== 2 or if t ==3 then
> true, otherwise
> false
> 
> --
> View this message in context: http://r.789695.n4.nabble.com/Why-doesn-t-this-work-tp3383656p3383656.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> 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.
> 
> ______________________________________________
> 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.
>



More information about the R-help mailing list