rw: Read and write 'rezrDF's as CSV files

rez_write_csvR Documentation

Read and write rezrDFs as CSV files

Description

Replacement of readr readr::read_csv() and readr::write_csv(), but contains added functionality for dealing with rezrDFs more easily.

Usage

rez_write_csv(df, path, inclCols = character(0), exclCols = character(0), ...)

rez_read_csv(
  path,
  origDF = NULL,
  lubridate = F,
  inclCols = character(0),
  exclCols = character(0),
  ...
)

Arguments

df

The rezrDF to be exported.

path

The path from which a CSV is to be imported / exported.

inclCols

Columns to be included from the import / export.

exclCols

Columns to be excluded from the import / export.

...

Arguments passed onto readr::read_csv() and readr::write_csv()

origDF

The rezrDF that originally produced this CSV, used to identify data types of the columns.

lubridate

Are you using the lubridate package?

Value

For rez_read_csv(), a data.frame for the CSV being imported. This is NOT a rezrDF, so please do not assign it to a rezrObj; use updateFromDF() to update an existing rezrDF with the imported data.frame.

Note

Includes a UTF-8 byte mark by default, so you can open the CSV directly in Excel. Whenever you export a .csv with the intention of importing it back, you must export the id column so that the resulting table can be merged back.

Examples

#rez_write_csv(sbc007$trackDF$default, "rez007_refexpr.csv", c("id", "tokenOrderLast", "text", "name"))
inpath = system.file("extdata", "rez007_refexpr_edited.csv", package = "rezonateR")
changeDF = rez_read_csv(inpath, origDF = rez007$trackDF$default)

johnwdubois/rezonateR documentation built on Nov. 19, 2024, 11:17 p.m.