Count number of objects in list

Karl picture Karl · Nov 16, 2009 · Viewed 253.3k times · Source

R function that will return the number of items in a list?

Answer

Joey picture Joey · Nov 16, 2009

length(x)

Get or set the length of vectors (including lists) and factors, and of any other R object for which a method has been defined.

lengths(x)

Get the length of each element of a list or atomic vector (is.atomic) as an integer or numeric vector.