Write out and Save a Tabular File

Share:

Description

A function that both writes a file to table with write.table, and saves it with the same name but a separate file extension.

Usage

1
kSave(x, file, lvl = 1, Rext = ".rda", ...)

Arguments

x

the R object you want to save / write to file

file

the location to write the file to, with extension desired for object written by write.table

lvl

how many extensions do you want to strip from your output file?

Rext

the extension to use for the saved object.

...

optional arguments passed to write.table

Examples

1
2
3
4
5
dat <- data.frame( x=c(1,2,3), y=c('a','b','c') )
kSave( dat, file="dat.txt" )
## the file 'dat.rda' is written as well - let's see if it exists
dat2 <- kLoad( "dat.rda" )
stopifnot( identical(dat, dat2) ) ## TRUE

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.