Description Usage Arguments Value See Also Examples
View source: R/quest_functions.R
ave_dfm
evaluates a function on a set of variables vrb.nm
separately for each group within grp.nm
. The results are combined back
together in line with the rows of data
similar to ave
.
ave_dfm
is different than ave
or agg
because it operates
on a data.frame, not an atomic vector.
1 |
data |
data.frame of data. |
vrb.nm |
character vector of colnames in |
grp.nm |
character vector of colnames in |
fun |
function that returns an atomic vector of length 1. Probably makes sense to ensure the function always returns the same typeof as well. |
... |
additional named arguments to |
atomic vector of length = nrow(data)
providing the result of
the function fun
for the subset of data with that group value (i.e.,
data[levels(interaction(data[grp.nm]))[i], vrb.nm]
) for that row.
ave
for the same functionality with atomic vector inputs
agg_dfm
for similar functionality with data.frames, but can return
the result for each group once rather than repeating the result for each group
value in the data.frame
1 2 3 4 5 6 7 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.