Extract Object Created within User-Defined Function in R (Example Code)
This article demonstrates how to print an object created within a manually defined function in R.
Example: Manually Construct Function with Double Arrow
example_function <- function(my_input) { # Constructing user-defined function my_output <<- my_input + 10 } |
example_function <- function(my_input) { # Constructing user-defined function my_output <<- my_input + 10 }
example_function(my_input = 1) # Applying user-defined function my_output # Displaying output of user-defined function # [1] 11 |
example_function(my_input = 1) # Applying user-defined function my_output # Displaying output of user-defined function # [1] 11