I got a dataset file the other day with an .rds extension. I had never seen this, but with a quick Google, I figured out this was a dataset exported from r. The extension is for “R DataSet”.
That’s interesting, but how do I get this data into my workspace? Does readcsv just work on this? It doesn’t, as you can see here:
The format used is different, and there is a separate function to get this data. I searched and found this link, which describes loading data in the two different ways. Looks easy, so let’s try it. I’ll use the readRDS function in code like this:
> qb.2016 <- readRDS(file="passingleaders2016.rds")
This works well, as we can see below. I get my data loaded in.
The first link above recommends this for working in R, but I often am going from a database or other system to R, so I think I’ll mostly stick with CSV. It’s good to know how to load them, if I do need to work with these files.