# NOT RUN {
if(require("rio")) {
head(Duncan, 3) # first three rows
Export(Duncan, "Duncan.csv", keep.row.names="occupation")
Duncan2 <- Import("Duncan.csv") # Automatically restores row.names and factors
brief(Duncan2)
identical(Duncan, Duncan2) # FALSE because type is of a different class
Duncan3 <- Import("Duncan.csv", stringsAsFactors=TRUE)
brief(Duncan3)
identical(Duncan, Duncan3) # TRUE type is of same class
# cleanup
unlink("Duncan.csv")
}
# }
Run the code above in your browser using DataLab