if (FALSE) {
#############################################################################
# EXAMPLE 1: Save dataset data.ma01
#############################################################################
#*** use data.ma01 as an example for writing data files using save.data
data(data.ma01)
dat <- data.ma01
# set a working directory
pf2 <- "P:/ARb/temp_miceadds"
# save data in Rdata format
miceadds::save.data( dat, filename="ma01data", type="Rdata", path=pf2)
# save data in table format without row and column names
miceadds::save.data( dat, filename="ma01data", type="table", path=pf2,
row.names=FALSE, na=".", col.names=FALSE)
# save data in csv2 format, including time stamp in file name
# and row index and time stamp in saved data
miceadds::save.data( dat, filename="ma01data", type="csv2", path=pf2,
row.names=FALSE, na="", suffix=systime()[5],
index=TRUE, systime=TRUE )
# save data in sav format
miceadds::save.data( dat, filename="ma02data", type="sav", path=pf2 )
# save data file in different formats
types <- c("Rdata", "csv2", "sav")
sapply( types, FUN=function(type){
miceadds::save.data( dat, filename="ma02data", type=type, path=pf2,
suffix=miceadds::systime()[3], row.names=TRUE )
} )
# save data frame in multiple file formats (sav, table and csv2)
miceadds::save.data( dat, filename="ma03data", type=c("sav","table","csv2"), path=pf2,
suffix=miceadds::systime()[7] )
}
Run the code above in your browser using DataLab