Description Usage Arguments Value
View source: R/applytoeachinlist.R
Apply a function to each member of a list, possibly splitting a dataframe alongside the list (e.g. to supply newdata to every member of a list)
1 2 3 4 5 6 7 8 9 10 |
listobject |
A named list object containing elements to which the applyfun will be applied. |
applyfun |
The character name of a function to apply. |
applyargs |
A named list of arguments supplied to applyfun. |
fallbackargs |
A named list of arguments to try in case the primary 'applyargs' fail. |
nameaftersplit |
The name of the argument of applyfun that takes the settosplit dataframe after it has been split; this is commonly 'x' or 'data' |
splitalongside |
An optional dataframe that should be split alongside the listobject, containing the factor variable splitalongsidename. For example, if listobject is a list of regressions, then splitalongside may be a set of newdata, indexed so that predictions for each regression depend only on some subset of splitalongside |
splitalongsidename |
what should the splitalongside frame be called after it has been split? This is commonly something like "newdata" |
splitalongsidesplitter |
The name of the factor variable in settosplit, over which it should be split. |
This function returns a named list of results, having applied applyfun to settosplit for every level of the 'over' variable. So for example, applytoeachinlist(...)[["a"]] is the result of applyfun(listobject[["a"]]).
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.