Hi Jonathan,

Try this:

 # list of data frames

mylist <- list(d1 = matrix(rnorm(100), ncol = 10),

                   d2 = matrix(rnorm(100), ncol = 5),

                   d3 = matrix(rnorm(100), ncol = 20))


# max number of rows

max(do.call(c, lapply(mylist, nrow)))

# [1] 20


HTH,
Jorge


On Thu, Aug 19, 2010 at 11:42 AM, Jonathan <> wrote:

> Hi All,
>    Anyone know how to quickly query some summary information on the
> components of a list?
>
> For example, I have a list that contains dataframes (originally
> generated by using split() on one large data frame).
>
>
> I simply want to know the number of rows in the longest dataframe from the
> list.
>
> Example, if my list has 3 data frames, and the first has 2 rows, the
> second 8 rows, and the third 3 rows, I want to ask something like:
>
>
> max(nrow(myList))
> which would ideally return "8".
>
>
> but this is obviously wrong syntax.
>
> Currently, I'm looping through each of the data frames in the list,
> searching for the max rows, but I'm sure there must be a faster way.
>
> Thanks,
> Jonatahn
>
> ______________________________________________
> 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.
>

        [[alternative HTML version deleted]]

______________________________________________
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