eu.vl
eu.vl

Reputation: 192

Create a list of lengths

I have a list 'T_1', where each element is a list of numbers.

I can get the length of the first element by

length(T_1[[1]])

as I understood.

Is it possible to create a new list of lengths of all elements from T_1 without a for loop? And if not how to do it with a for loop?

Upvotes: 0

Views: 62

Answers (1)

Sven Hohenstein
Sven Hohenstein

Reputation: 81693

lapply(T_1, length)

will do the trick.

Upvotes: 3

Related Questions