Description Usage Arguments Details Value Examples
Returns a data list (or list of data lists) obtained by attempting to apply a function to margins of each variable in a data list.
1 2 3 4 5 |
X |
A data list |
MARGIN |
See |
FUN |
See |
simplify |
Should the result be simplified to a data frame? |
... |
Optional arguments to |
Essentially, dlapply
works by passing each variable in X
to apply
. For each variable, the dimensions identified by MARGIN
are only used if that variable is replicated along that dimension.
Because data lists may contain very different variables, it is not guaranteed that FUN
will generate anything useful for each variable in X
. If an error occurs during a call to apply
, that variable is simply removed from the output with a message. Variables may also be removed (also with a message) because they are not replicated along any of the dimensions specified by MARGIN
.
FUN
may induce a new dimension to the data list because its return value has length greater than one. In this case, the new dimension is called as.character(substitute(FUN))
. However, if the length of this new dimension differs among variables, then a data list cannot be constructed and instead a list of the variables (in data list form) is returned (with a message).
The variable_margins
function returns a list with one vector for each variable, giving the value for MARGIN
when passing X
to apply
. This is helpful when figuring out why dlcast
results in an error.
A data list or list of data lists.
1 2 3 | data(fake.community)
dlapply(fake.community, 1, quantile, na.rm = TRUE)
dlapply(fake.community, c(1,3), quantile, na.rm = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.