[R] How to access data structure (List of List)
Gundala Viswanath
gundalav at gmail.com
Mon Jun 23 09:28:09 CEST 2008
Hi,
I have this kind of output.
> str(nw)
List of 3
$ :List of 2
..$ part1: num 30.9
..$ part2: num [1:78] 60.1 70.0 73.0 75.0 83.9 ...
$ :List of 2
..$ part1: num [1:2] 30.9 60.1
..$ part2: num [1:77] 70.0 73.0 75.0 83.9 93.1 ...
$ :List of 2
..$ part1: num [1:3] 30.9 60.1 70
..$ part2: num [1:76] 73.0 75.0 83.9 93.1 97.6 ...
My question are:
1. What kind of data structure is it? List of List?
2. How can I access it's element?
I tried the following loop but seem to fail
for (i in 1:length(nw)) {
print(nw[i]$part1)
}
Please advice.
- Gundala Viswanath
Jakarta - Indonesia
More information about the R-help
mailing list