Skip to content

Instantly share code, notes, and snippets.

@PietrH
Created August 11, 2025 11:42
Show Gist options
  • Save PietrH/af939f3d29f36002f2c25a006b0ea292 to your computer and use it in GitHub Desktop.
Save PietrH/af939f3d29f36002f2c25a006b0ea292 to your computer and use it in GitHub Desktop.
Get default value for a function argument in R
return_default <- function(my_param = 50){
rlang::eval_bare(formals(rlang::caller_fn(0))[["my_param"]])
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment