rlengths | R Documentation |
lengths for recursive lists
rlengths(x, doSum = NULL, ...)
x |
|
doSum |
|
... |
additional parameters are ignored |
This function takes a list as input, and returns the length
of each list element after running base::unlist()
.
When doSum is NULL
(default) it returns an integer
vector
with length length(x)
and names names(x)
,
whose values are the total number of elements in each item in
x
after running base::unlist()
.
When doSum=="TRUE"
, it returns the single integer
length of
all elements in x
.
When doSum=="FALSE"
, it returns the full structure of x
with the
integer
length of each element.
The parameter doSum
is intended for internal use, during
recursive calls of rlengths()
to itself. When doSum is NULL
or
TRUE
, recursive calls to rlengths()
set doSum=TRUE
.
Other jam list functions:
cPasteSU()
,
cPasteS()
,
cPasteUnique()
,
cPasteU()
,
cPaste()
,
heads()
,
jam_rapply()
,
list2df()
,
mergeAllXY()
,
mixedSorts()
,
rbindList()
,
relist_named()
,
sclass()
,
sdim()
,
uniques()
,
unnestList()
x <- list(
A=list(
A1=nameVector(1:3, letters[1:3]),
A2=list(
A1a=nameVector(4:7, letters[4:7]),
A1b=nameVector(11:14, letters[11:14]))),
B=list(B1=nameVector(1:9, letters[1:9]),
B2=nameVector(20:25, letters[20:25])));
# default lengths(x) shows length=2 for A and B
lengths(x)
# rlengths(x) shows the total length of A and B
rlengths(x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.