postponeAction(expr, key = digest(tempfile()), group = NULL, envir = topns(strict = FALSE), verbose = getOption("verbose")) runPostponedAction(group = NULL, verbose = getOption("verbose"))
This function implement a mechanism to postpone actions,
which can be executed at a later stage. This is useful
when developing packages, where actions that need to be
run in the link{.onLoad}
function but can be
defined close to their context.
opt <- options(verbose=2)# define actionspostponeAction(function(){print(10)}, "print")# Postponing action 'print'postponeAction(function(){print(1:10)}, "more")# Postponing action 'more'postponeAction()[1] "print" "more"# execute actionsrunPostponedAction()# Executing postponed action(s) in package 'R_GlobalEnv' ... ** Action 'print' [R_GlobalEnv][1] 10** Action 'more' [R_GlobalEnv][1] 1 2 3 4 5 6 7 8 9 10OK [2]runPostponedAction()# Executing postponed action(s) in package 'R_GlobalEnv' ... OK [0]# restore optionsoptions(opt)