Learn R Programming

Luminescence (version 0.7.1)

write_RLum2CSV: Export RLum-objects to CSV

Description

This function exports RLum-objects to CSV-files using the R function write.table. All RLum-objects are supported, but the export is lossy, i.e. the pure numerical values are exported only. Information that cannot be coerced to a data.frame or a matrix are discarded as well as metadata.

Usage

write_RLum2CSV(object, path = NULL, prefix = "", export = TRUE, ...)

Arguments

object
RLum or a list of RLum objects (required): objects to be written
path
character (optional): character string naming folder for the output to be written. If nothing is provided path will be set to the working directory. Note: this argument is ignored if the the argument export is set to FALSE.
prefix
character (with default): optional prefix to name the files. This prefix is valid for all written files
export
logical (with default): enable or disable the file export. If set to FALSE nothing is written to the file connection, but a list comprising objects of type link{data.frame} and matrix is returned instead
...
further arguments that will be passed to the function write.table. All arguments except the argument file are supported

Value

The function returns either a CSV-file (or many of them) or for the option export == FALSE a list comprising objects of type link{data.frame} and matrix

Function version

0.1.1 (2017-01-24 21:10:47)

How to cite

Kreutzer, S. (2017). write_RLum2CSV(): Export RLum-objects to CSV. Function version 0.1.1. In: Kreutzer, S., Dietze, M., Burow, C., Fuchs, M.C., Schmidt, C., Fischer, M., Friedrich, J. (2017). Luminescence: Comprehensive Luminescence Dating Data Analysis. R package version 0.7.1. https://CRAN.R-project.org/package=Luminescence

Details

However, in combination with the implemented import functions, nearly every supported import data format can be exported to CSV-files, this gives a great deal of freedom in terms of compatibility with other tools.

Input is a list of objects

If the input is a list of objects all explicit function arguments can be provided as list.

See Also

RLum.Analysis, RLum.Data, RLum.Results, write.table

Examples

Run this code

##transform values to a list
data(ExampleData.BINfileData, envir = environment())
object <- Risoe.BINfileData2RLum.Analysis(CWOSL.SAR.Data)[[1]]
write_RLum2CSV(object, export = FALSE)

## Not run: 
# 
# ##export data to CSV-files in the working directory;
# ##BE CAREFUL, this example creates many files on your file system
# data(ExampleData.BINfileData, envir = environment())
# object <- Risoe.BINfileData2RLum.Analysis(CWOSL.SAR.Data)[[1]]
# write_RLum2CSV(object, export = FALSE)
# 
# ## End(Not run)

Run the code above in your browser using DataLab