Skip to contents

Writes one .csv per table into dir. Subject to the same losses as hb_write_xlsx(); see its documentation. Each file is named after its table, with the characters a file name cannot hold on some system - / \ : * ? " < > | and control characters - replaced by _. Table names that produce the same filename (ignoring case) are rejected before any files are written.

Usage

hb_write_csv(x, dir, ..., tables = NULL)

Arguments

x

A harbour_dtable, or a harbour_client to read from first.

dir

Destination directory. Created if it does not exist.

...

These dots are for future extensions and must be empty.

tables

Table names to export. Default: all of them.

Value

A character vector of the files written, invisibly.

Examples

base <- hb_read_dtable(
  system.file("extdata", "example.dtable", package = "harbouR")
)
dir <- tempfile()
hb_write_csv(base, dir)
#> ! 7 columns were flattened to text.
#> • Samples$Tags, Samples$Collaborators, Samples$Photos, Samples$Reports,
#>   Samples$Where, Samples$Action, and Samples$Signature
#> ℹ A spreadsheet cell holds one value. Use `hb_write_dtable()` to keep the
#>   structure.
list.files(dir)
#> [1] "Reference.csv" "Samples.csv"  
unlink(dir, recursive = TRUE)