Re: [R] jagged array

From: Spencer Graves <spencer.graves_at_pdf.com>
Date: Sun 03 Jul 2005 - 13:24:50 EST

          Access list items using "[[". "res[1]" is a list with only one attribute. "res[1][1]" is the same list with only one attributre. "res[[1]]" is the first attribute of that list, so res[[1]][1] in your example should be 3.125.

          spencer graves

Tolga Uzuner wrote:

> Berton Gunter wrote:
> 
> 

>>Please read "An Introduction to R" and the help file for "[", where this is
>>explained. If you want to use R, you need to expend effort to learn it.
>>
>>-- Bert Gunter
>>
>>-----Original Message-----
>>From: r-help-bounces@stat.math.ethz.ch
>>[mailto:r-help-bounces@stat.math.ethz.ch] On Behalf Of Tolga Uzuner
>>Sent: Saturday, July 02, 2005 4:41 PM
>>To: r-help@stat.math.ethz.ch
>>Subject: [R] jagged array
>>
>>Hi,
>>
>>I have a "jagged array" which looks like this:
>>
>>
>>>res
>>
>>...
>>[[996]]
>>[1] 1.375 3.375 4.125 4.625 4.875 4.875 6.625 7.125 8.875
>>
>>[[997]]
>>[1] 1.875 5.125 6.875 7.875 9.875
>>
>>[[998]]
>>[1] 1.875 5.375 6.625 6.875 8.125 9.375 9.625
>>
>>[[999]]
>>[1] 1.875 6.875 9.875
>>
>>[[1000]]
>>[1] 1.875 6.125 6.875 9.375 9.625
>>
>>
>>Now, I want to use the first row,so I say res[1]
>>
>>
>>>res[1]
>>
>>[[1]]
>>[1] 3.125 4.375 4.625 5.125 5.375 6.375 6.875 7.875 9.125 9.125 9.375 9.375
>>
>>How do I access, an element within this ? I try
>>
>>
>>>res[1][1]
>>
>>[[1]]
>>[1] 3.125 4.375 4.625 5.125 5.375 6.375 6.875 7.875 9.125 9.125 9.375 9.375
>>
>>which returns the same vector.. ??? How do I "get to" 3.125 ?
>>
>>Thanks
>>
>>______________________________________________
>>R-help@stat.math.ethz.ch mailing list
>>https://stat.ethz.ch/mailman/listinfo/r-help
>>PLEASE do read the posting guide!
>>http://www.R-project.org/posting-guide.html
>>
>>
>>
>>
>>
> 
> tx
> 
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

-- 
Spencer Graves, PhD
Senior Development Engineer
PDF Solutions, Inc.
333 West San Carlos Street Suite 700
San Jose, CA 95110, USA

spencer.graves@pdf.com
www.pdf.com <http://www.pdf.com>
Tel:  408-938-4420
Fax: 408-280-7915

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Sun Jul 03 13:28:49 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:33:11 EST