# export
library("datasets")
export(mtcars, "mtcars.csv") # comma-separated values
export(mtcars, "mtcars.rds") # R serialized
export(mtcars, "mtcars.sav") # SPSS
# import
x <- import("mtcars.csv")
y <- import("mtcars.rds")
z <- import("mtcars.sav")
# convert
convert("mtcars.sav", "mtcars.dta")
# cleanup
unlink(c("mtcars.csv", "mtcars.rds", "mtcars.sav", "mtcars.dta"))
Run the code above in your browser using DataLab