laply {plyr} | R Documentation |
For each element of a list, apply function then combine
results into an array. laply
is similar in spirit
to sapply
except that it will always return
an array, and the output is transposed with respect
sapply
- each element of the list corresponds to a
column, not a row.
laply(.data, .fun = NULL, ..., .progress = "none", .drop = TRUE, .parallel = FALSE)
.fun |
function to apply to each piece |
... |
other arguments passed on to |
.progress |
name of the progress bar to use, see
|
.data |
list to be processed |
.parallel |
if |
.drop |
should extra dimensions of length 1 in the
output be dropped, simplifying the output. Defaults to
|
if results are atomic with same type and dimensionality, a vector, matrix or array; otherwise, a list-array (a list with dimensions)
This function splits lists by elements and combines the result into a data frame.
If there are no results, then this function will return a
vector of length 0 (vector()
).
Hadley Wickham (2011). The Split-Apply-Combine Strategy for Data Analysis. Journal of Statistical Software, 40(1), 1-29. http://www.jstatsoft.org/v40/i01/.
Other array output: aaply
,
daply
Other list input: ldply
,
llply
laply(baseball, is.factor) # cf ldply(baseball, is.factor) colwise(is.factor)(baseball) laply(seq_len(10), identity) laply(seq_len(10), rep, times = 4) laply(seq_len(10), matrix, nrow = 2, ncol = 2)