R Utilities: Saving/Writing Data Files using miceadds
This function is a wrapper function for saving or writing data frames or matrices.
save.data( data, filename, type="Rdata", path=getwd(), row.names=FALSE, na=NULL, suffix=NULL, suffix_space="__", index=FALSE, systime=FALSE, ...)
data |
Data frame or matrix to be saved |
filename |
Name of data file |
type |
The type of file in which the data frame or matrix should be loaded.
This can be |
path |
Directory from which the dataset should be loaded |
row.names |
Optional logical indicating whether row names
should be included in saved |
na |
Missing value handling. The default is |
suffix |
Optional suffix in file name. |
suffix_space |
Optional place holder if a suffix is used. |
index |
Optional logical indicating whether an index should be
included in the first column using the function
|
systime |
If |
... |
Further arguments to be passed to |
See load.Rdata
and load.data
for saving/writing R data frames.
## Not run: ############################################################################# # 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] ) ## End(Not run)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.