The answer is: 

    sapply(mlist, length)

to the question :

>>>>> "Benjamin" == Benjamin Otto <[EMAIL PROTECTED]>
>>>>>     on Fri, 19 May 2006 12:09:43 +0200 writes:

    Benjamin> Hi, is there some elegant way to determine the
    Benjamin> number of components stored in each list element?

    Benjamin> Example:

    Benjamin> The list: ---------
    >> list

    Benjamin> $Elem1 [1] A B C

    Benjamin> $Elem1 [1] D

    Benjamin> $Elem1 [1] E F

    Benjamin> Then normal command "length(list)" would return
    Benjamin> 3. But I would like some command return the array
    Benjamin> of the single element lengths like

    Benjamin> [1] 3 1 2

    Benjamin> so I can afterwards get my list subset with only
    Benjamin> entries which have a certain amount of components
    Benjamin> bigger or lower than a certain threshold.

    Benjamin> regards

    Benjamin> Benjamin

    Benjamin> ______________________________________________
    Benjamin> R-help@stat.math.ethz.ch mailing list
    Benjamin> https://stat.ethz.ch/mailman/listinfo/r-help
    Benjamin> PLEASE do read the posting guide!
    Benjamin> http://www.R-project.org/posting-guide.html

______________________________________________
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

Reply via email to