On Aug 8, 2008, at 5:18 PM, <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> wrote:

I have a beginner question. After I finally get the data to a data.frame that I can work with I have the following a data frame that is fairly long:

length(r2007)
[1] 17409

If I look at the first element:

r2007[1]
$`100009`
  DayOfYear Quantity
1        66        1
2       128        1
3       137        1
4       193        1

Now how do I get the length of this list (actually it is another data.frame)?

I have tried:

length(r2007[1])
[1] 1

Not right. And:

length(r2007[1]$DayOfYear)
[1] 0

Also not right the length returned should be 4 from the output above. I want to use this to iterate through the object. So in the outer loop I would have:

for(i in 1:length(r2007))
{
. . . .
}

I need to form an inner loop and an expression that returns each row (as above).



Hi,

Use nrow() and ncol() to determine the number of rows and columns of a data frame.

Cheers,
Ben



Ben Tupper
[EMAIL PROTECTED]

I GoodSearch for Ashwood Waldorf School.

Raise money for your favorite charity or school just by searching the Internet with GoodSearch - www.goodsearch.com - powered by Yahoo!

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to