% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/write_RLum2CSV.R
\name{write_RLum2CSV}
\alias{write_RLum2CSV}
\title{Export RLum-objects to CSV}
\usage{
write_RLum2CSV(
  object,
  path = NULL,
  prefix = "",
  export = TRUE,
  compact = TRUE,
  ...
)
}
\arguments{
\item{object}{\linkS4class{RLum} or a \link{list} of \code{RLum} objects (\strong{required}):
objects to be written. Can be a \link{data.frame} if needed internally.}

\item{path}{\link{character} (\emph{optional}):
character string naming folder for the output to be written. If nothing
is provided \code{path} will be set to the working directory.
\strong{Note:} this argument is ignored when \code{export = FALSE}.}

\item{prefix}{\link{character} (\emph{with default}):
optional prefix to name the files. This prefix is valid for all written files}

\item{export}{\link{logical} (\emph{with default}):
enable/disable the file export. If set to \code{FALSE} nothing is written to
the file connection, but a list comprising objects of type \link{data.frame} and \link{matrix}
is returned instead.}

\item{compact}{\link{logical} (\emph{with default}): if \code{TRUE} (default) the output
will be simpler but less comprehensive, that is not all elements in the
objects will be fully broken down. This is in particular useful for writing
\code{RLum.Results} objects to CSV files, as such objects can be rather complex
and not all information are needed in a CSV file or can be meaningfully
translated to CSV format.}

\item{...}{further arguments that will be passed to the function
\link[utils:write.table]{utils::write.table}. All arguments except the argument \code{file} are supported}
}
\value{
The function returns either a CSV-file (or many of them) or for the
option \code{export == FALSE} a list comprising objects of type \link{data.frame} and \link{matrix}
}
\description{
This function exports \linkS4class{RLum}-objects to CSV-files using the R function
\link[utils:write.table]{utils::write.table}. All \linkS4class{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 \link{data.frame} or a \link{matrix} are discarded as well as
metadata.
}
\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.

\strong{Input is a list of objects}

If the input is a \link{list} of objects all explicit function arguments can be provided
as \link{list}.
}
\section{Function version}{
 0.2.2
}

\examples{

## 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)

\dontrun{
## write to a temporary file
temp_file <- tempfile(pattern = "output", fileext = ".csv")
write_RLum2CSV(object, temp_file)

## write to the working directory
write_RLum2CSV(object)
}

}
\seealso{
\linkS4class{RLum.Analysis}, \linkS4class{RLum.Data}, \linkS4class{RLum.Results},
\link[utils:write.table]{utils::write.table}
}
\author{
Sebastian Kreutzer, Geography & Earth Science, Aberystwyth University (United Kingdom)
, RLum Developer Team} 

\section{How to cite}{
Kreutzer, S., 2025. write_RLum2CSV(): Export RLum-objects to CSV. Function version 0.2.2. In: Kreutzer, S., Burow, C., Dietze, M., Fuchs, M.C., Schmidt, C., Fischer, M., Friedrich, J., Mercier, N., Philippe, A., Riedesel, S., Autzen, M., Mittelstrass, D., Gray, H.J., Galharret, J., Colombo, M., Steinbuch, L., Boer, A.d., 2025. Luminescence: Comprehensive Luminescence Dating Data Analysis. R package version 1.1.2. https://r-lum.github.io/Luminescence/
}

\keyword{IO}
