Search code examples
rloadingreadr

Loading Data into Rstudio


What am I doing wrong in this?

library(readr)
source.data= (file.path("C", "User","Administrator", "Documents","Classes","Fall_2018","Econ380"))
"weather <- read_rds'(file.path(source.data, VirginiaWeather2017.rds))

Error: unexpected string constant in

Error: Incomplete expression: weather <- read_rds'(file.path(source.data,CollegeParkWeather2017.rds))


Solution

  • Welcome to Stack Overflow and R. There is a typo in that readr::read_rds---the extra apostrophe. Also, you would need to wrap the rds object in double quotes, and put a colon after the C.

    How does the following work?

    library(readr)
    source.data <- 
      file.path("C:", "User", "Administrator", "Documents", "Classes", "Fall_2018", "Econ380")
    weather <- read_rds(file.path(source.data, "VirginiaWeather2017.rds"))
    

    Let me know if that did not do the trick.