Learn R Programming

GCubeR (version 0.1.3)

export_output: Export data frame to CSV with warnings instead of errors

Description

This function exports a data.frame to a CSV file. If output is NULL, nothing is done. If the path is invalid or the export fails, a warning is issued but the function does not stop, and still returns (invisibly) a logical value indicating success.

Usage

export_output(data, output, verbose = FALSE)

Value

Invisibly returns TRUE if the export succeeded, FALSE

otherwise.

Arguments

data

A data.frame to export.

output

Character string: path to the CSV file. If NULL, nothing is done.

verbose

Logical. If TRUE, prints diagnostic messages. Default: FALSE.

Examples

Run this code
df <- data.frame(
  id = 1:3,
  volume = c(10.5, 12.3, 9.8)
)

export_output(df, file.path(tempdir(), "volumes.csv"))

Run the code above in your browser using DataLab