What is the objects() function in R?
Overview
The objects() function in R returns the functions and variables defined in a given workspace.
Syntax
objects()
The syntax for the objects() function in R
Parameter value
The objects() function takes no parameter value.
Example
# creating a functionmy_function <- function(x, y){return (x + y)}# creating variablesvar_1 <- "Theo"var_2 <- "10"# returning the function and variablesobjects()
Explanation
- Line 2-4: We create a function,
my_function. - Line 7-8: We create variables,
var_1andvar_2. - Line 11: We obtain all the variables and the function present in the working space using the
objects()function.