[R] Array help

Patrick Burns pburns at pburns.seanet.com
Mon Nov 29 11:32:23 CET 2010

Instead of:


I think you mean:

   c(7:11, 23:34)

Using '&' for concatenation
is not an unreasonable idea,
but it is decidedly not what
R does.

It would be instructive to do:

   7:11 & 23:34

at the R prompt to see what you

On 29/11/2010 03:56, bfhancock wrote:
> Josh, the data set is called StatTemps and is in the PASWR package.  I want
> to make an array that involves only the 8 a.m. and a separate array that
> involves only the 9 a.m. so i can get info on the temperatures in those
> groups. So I still want it in the format of StatTemps but in two arrays that
> are based on 8 a.m. or 9 a.m.    I have been messing with this for a while.
> And no it's not homework, I am just trying to learn R so I am more appealing
> out in the field eventually.  They book I am using is confusing!  Hopefully
> what I am trying to do isn't confusing.  I want to do an array that holds
> the info from 1:6&  12:22 for 8am and then 7:11&  23:34 for 9am.  I was able
> easily make two arrays based on sex by just putting in StatTemps[1:11,,]&
> StatTemps[12:34,,] and assumed I could just go StatTemps[1:6&12:22,,] and
> StatTemps[7:11&23:34,,] but that didn't work. Any ideas? Thanks so much!
> -B

Patrick Burns
pburns at pburns.seanet.com
(home of 'Some hints for the R beginner'
and 'The R Inferno')

More information about the R-help mailing list