extractFunctions | R Documentation |
This function extracts nested named functions (not anonymous functions) from a function and returns both these nested functions and the modified function with the functions removed.
This deals with nested functions but does not indicate where the extracted functions occured.
The purpose of this is to facilitate refactoring code and moving nested functions to separate functions that can be reused and tested separately from the original function.
mkGlobalsLocal
can also be used to
update both the extracted functions and the original function
to fix calls to include the additional non-local arguments.
extractFunctions(fun)
fun |
the function to be processed |
A list with 2 elements
newFun |
the modified version of the original function |
nested |
a named list of the nested functions |
Duncan Temple Lang
mkGlobalsLocal
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.