write_RLum2CSV: Export RLum-objects to CSV

Description Usage Arguments Details Value Function version How to cite Author(s) See Also Examples

View source: R/write_RLum2CSV.R

Description

This function exports RLum-objects to CSV-files using the R function utils::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

1
2
3
4
5
6
7
8
write_RLum2CSV(
  object,
  path = NULL,
  prefix = "",
  export = TRUE,
  compact = 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 data.frame and matrix is returned instead

compact

logical (with default): if TRUE (the default) the output will be more simple but less comprehensive, means not all elements in the objects will be fully broken down. This is in particular useful for writing RLum.Results objects to CSV-files, such objects can be rather complex and not all information are needed in a CSV-file or can be meaningful translated to it.

...

further arguments that will be passed to the function utils::write.table. All arguments except the argument file are supported

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.

Value

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

Function version

0.2.0

How to cite

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

Author(s)

Sebastian Kreutzer, IRAMAT-CRP2A, UMR 5060, CNRS - Université Bordeaux Montaigne (France) , RLum Developer Team

See Also

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
##transform values to a list (and do not write)
data(ExampleData.BINfileData, envir = environment())
object <- Risoe.BINfileData2RLum.Analysis(CWOSL.SAR.Data)[[1]]
write_RLum2CSV(object, export = FALSE)

## Not run: 

##create temporary filepath
##(for usage replace by own path)
temp_file <- tempfile(pattern = "output", fileext = ".csv")

##write CSV-file to working directory
write_RLum2CSV(temp_file)


## End(Not run)

R-Lum/Luminescence documentation built on Jan. 4, 2020, 10:44 p.m.