The “read_rds” Function in R
Package: base (part of the R base package)
Purpose: To read an R object saved in .rds format.
General Class: Data Import
Required Argument(s):
file: The path to the .rds file to read.
Notable Optional Arguments: None
Example (with Explanation):
# Read an R object saved in .rds format
data <- read_rds("data.rds")
# Display information about the loaded object
print(data)In this example, the read_rds function from the base R package is used to read an R object saved in .rds format from the file “data.rds” into the R environment. The loaded object is then printed to the console. This function is commonly used to load saved R objects for further analysis or processing.