[R] How to iterate dataframe within a hash
Gundala Viswanath
gundalav at gmail.com
Wed Dec 17 03:02:00 CET 2008
Dear all,
I have the following data structure
> print(testlib)
$tags
tag count.raw count.adj err
1 aaaaaaaaaa 94 93 0.5
2 aaaaaaaaac 1 2 0.2
3 aaaaaaaaag 3 2 0.1
4 aaaaaaaaca 1 1 0.003
I want to iterate the data above and print only
"tag", "count.raw" and "count.adj" column.
Why my script below failed to do the task?
for (i in 1:nrow(testlib)) {
cat(testlib$tags[["count.tag"]],",", testlib$tags[["count.raw"]],
",", testlib$tags[["count.adj"]],"\n")
}
- Gundala Viswanath
Jakarta - Indonesia
More information about the R-help
mailing list