write_symbolic_csv: Write Symbolic Data to a CSV File

View source: R/utilities.R

write_symbolic_csvR Documentation

Write Symbolic Data to a CSV File

Description

Writes a symbolic data object (interval, histogram, modal, or any data frame) to a CSV file. Interval data stored in RSDA format (symbolic_tbl with complex columns) is automatically converted to MM format (paired _min/_max columns) before writing.

Usage

write_symbolic_csv(
  x,
  file,
  sep = ",",
  row.names = TRUE,
  na = "NA",
  quote = TRUE,
  ...
)

Arguments

x

A data.frame, symbolic_tbl, or other tabular object containing symbolic data.

file

Path to the output CSV file.

sep

Field separator character. Default ",".

row.names

Logical or character. If TRUE (the default), row names are written as the first column.

na

Character string to use for missing values. Default "NA".

quote

Logical; should character and factor columns be quoted? Default TRUE.

...

Additional arguments passed to write.table.

Details

write_symbolic_csv handles every tabular symbolic type stored in dataSDA:

  • Interval (RSDA): symbolic_tbl objects with complex interval columns are converted to MM format before writing.

  • Interval (MM): Data frames with _min/_max columns are written directly.

  • Histogram / Modal / Other: Plain data frames are written directly.

The output is a standard CSV that can be read back with read_symbolic_csv.

Value

Invisibly returns the data frame that was written (after any conversion).

See Also

read_symbolic_csv

Examples

# Interval data (RSDA symbolic_tbl)
data(mushroom.int)
tmp <- tempfile(fileext = ".csv")
write_symbolic_csv(mushroom.int, tmp)
cat(readLines(tmp, n = 3), sep = "\n")

# Histogram data
data(airline_flights.hist)
tmp2 <- tempfile(fileext = ".csv")
write_symbolic_csv(airline_flights.hist, tmp2)
cat(readLines(tmp2, n = 3), sep = "\n")

dataSDA documentation built on June 12, 2026, 9:06 a.m.