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 function
my_function <- function(x, y){
return (x + y)
}
# creating variables
var_1 <- "Theo"
var_2 <- "10"
# returning the function and variables
objects()

Explanation

  • Line 2-4: We create a function, my_function .
  • Line 7-8: We create variables, var_1 and var_2 .
  • Line 11: We obtain all the variables and the function present in the working space using the objects() function.

Free Resources