|
There are no translations available.
# Goal: All manner of import and export of datasets.
# Invent a dataset -- A <- data.frame(age=runif(10, min=0, max=100), gender=factor(sample(1:2, 10, replace=TRUE), labels=c("Male", "Female")), income=rlnorm(10, meanlog = 10, sdlog = 1))
# CSV files compatible with spreadsheets -- write.table(A,file="/tmp/demo.csv",sep = ",",col.names = NA,qmethod = "double") B <- read.table("/tmp/demo.csv", header = TRUE, sep = ",", row.names = 1)
# Open XML standard for transport for statistical data library(StatDataML) writeSDML(A, "/tmp/demo.sdml") B <- readSDML("/tmp/demo.sdml")
# Data exchange with Stata library(foreign) write.dta(A, "/tmp/demo.dta") B <- read.dta("/tmp/demo.dta")
# library(foreign) has lots of cool stuff: # Read, write DBF # Read Epi Info # Read Minitab portable worksheet # Read Octave text data files # Read, write SPSS data files # Read SAS ssd files or SAS XPORT format library # Read Systat files # It will even write an ascii file, and associated code, for reading # in the data for SPSS, Stata and SAS.
|