Re: [R] confusion with R syntax

2007-10-11 Thread Giovanni Petris
Mark, That has to do with how operators bind and their precedence. > Date: Thu, 11 Oct 2007 15:34:22 -0400 > From: "Leeds, Mark (IED)" <[EMAIL PROTECTED]> > Sender: [EMAIL PROTECTED] > Importance: normal > Priority: normal > Precedence: list > Thread-topic: confusion with R syntax > Thread-ind

Re: [R] confusion with R syntax

2007-10-11 Thread hadley wickham
On 10/11/07, Leeds, Mark (IED) <[EMAIL PROTECTED]> wrote: > thanks to all for your explanations. It seems like, because it's done > sequentially, you can put as many [] on as > you like as long as they make sense. It probably was a bad question but > this concept is quite different > from C which i

Re: [R] confusion with R syntax

2007-10-11 Thread Leeds, Mark (IED)
Mark -Original Message- From: Gabor Grothendieck [mailto:[EMAIL PROTECTED] Sent: Thursday, October 11, 2007 4:26 PM To: Andrew Robinson Cc: Leeds, Mark (IED); [EMAIL PROTECTED] Subject: Re: [R] confusion with R syntax Or with x <- 1:10 # these are all the same x[2:4][1] (x[2:4])[1] y <

Re: [R] confusion with R syntax

2007-10-11 Thread Greg Snow
gt; Sent: Thursday, October 11, 2007 1:34 PM > To: [EMAIL PROTECTED] > Subject: [R] confusion with R syntax > > I just noticed something by accident with R syntax that I'm > sure is correct but I don't understand it. If I have a simple > numeric vector x and I subscript it

Re: [R] confusion with R syntax

2007-10-11 Thread Gabor Grothendieck
Or with x <- 1:10 # these are all the same x[2:4][1] (x[2:4])[1] y <- x[2:4] y[1] On 10/11/07, Andrew Robinson <[EMAIL PROTECTED]> wrote: > Hi Mark, > > what's happening here is that R is applying the one-dimensional > subscripting operations sequentially. > > Try > > x <- seq(1,10) > x[2:4][

Re: [R] confusion with R syntax

2007-10-11 Thread Mark Wardle
On 11/10/2007, Leeds, Mark (IED) <[EMAIL PROTECTED]> wrote: > I just noticed something by accident with R syntax that I'm sure is > correct but I don't understand it. If I have > a simple numeric vector x and I subscript it, it seems that I can then > subscript a second time with TRUE > or FALSE, s

Re: [R] confusion with R syntax

2007-10-11 Thread Jim Lemon
Leeds, Mark (IED) wrote: > I just noticed something by accident with R syntax that I'm sure is > correct but I don't understand it. If I have > a simple numeric vector x and I subscript it, it seems that I can then > subscript a second time with TRUE > or FALSE, sort of like a 2 dimensional array i

Re: [R] confusion with R syntax

2007-10-11 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Leeds, Mark (IED) > Sent: Thursday, October 11, 2007 12:34 PM > To: [EMAIL PROTECTED] > Subject: [R] confusion with R syntax > > I just noticed something by accident with R

Re: [R] confusion with R syntax

2007-10-11 Thread Andrew Robinson
Hi Mark, what's happening here is that R is applying the one-dimensional subscripting operations sequentially. Try x <- seq(1,10) x[2:4][1] Cheers Andrew On Thu, Oct 11, 2007 at 03:34:22PM -0400, Leeds, Mark (IED) wrote: > I just noticed something by accident with R syntax that I'm sure is >

[R] confusion with R syntax

2007-10-11 Thread Leeds, Mark (IED)
I just noticed something by accident with R syntax that I'm sure is correct but I don't understand it. If I have a simple numeric vector x and I subscript it, it seems that I can then subscript a second time with TRUE or FALSE, sort of like a 2 dimensional array in C. Does someone know if this is d