How do I load an rds file into R

Rather than typing a long file path, a really good idea in R is to let the system do the typing for you. That is, do something like this:

 filename <- file.choose()
 Canteen_clean <- readRDS(filename)

The first line will open the usual file open dialog box; you can select the file you want, and the name will be stored in the filename variable. The second line will use that name to open it.


You can try using setwd()

reach to that folder location then use

list.files() 

to list all the files present in that folder

then use

t1 <- readRDS("/filename.rds")
head(t1)

to get that data.

Hope it solves your issue.

---------CODE---------------------------

> setwd(""C:/Users/a_s_j/OneDrive/Studie/Cand.merc.Business
> Intelligence/1. Semester/R for Business Analytics/.Rproj/39 -
> Graphics/Exercises02")
> 
> list.files()
> 
> t1 = readRDS("canteen_clean.rds") head(t1)

Tags:

R