Skip to contents

Function to write a single data.frame to an ods file.

Usage

write_ods(
  x,
  path,
  sheet = "Sheet1",
  append = FALSE,
  update = FALSE,
  row_names = FALSE,
  col_names = TRUE,
  na_as_string = getOption("write_ods_na", default = FALSE),
  verbose = NULL,
  overwrite = NULL
)

Arguments

x

a data.frame

path

Path to the ods file to write

sheet

Name of the sheet

append

logical, TRUE indicates that x should be appended to the existing file (path) as a new sheet. If a sheet with the same sheet_name exists, an exception is thrown. See update. Please also note that writing is slower if TRUE. Default is FALSE.

update

logical, TRUE indicates that the sheet with sheet_name in the existing file (path) should be updated with the content of x. If a sheet with sheet_name does not exist, an exception is thrown. Please also note that writing is slower if TRUE. Default is FALSE.

row_names

logical, TRUE indicates that row names of x are to be included in the sheet. Default is FALSE.

col_names

logical, TRUE indicates that column names of x are to be included in the sheet. Default is FALSE.

na_as_string

logical, TRUE indicates that NAs are written as string. Default is option("write_ods_na") (will change to TRUE in the next version).

verbose

logical, deprecated

overwrite

logical, deprecated.

Value

An ODS file written to the file path location specified by the user. The value of path is also returned invisibly.

Author

Detlef Steuer [email protected], Thomas J. Leeper [email protected], John Foster [email protected], Chung-hong Chan [email protected]

Examples

if (FALSE) {
# preserve the row names
write_ods(mtcars, "mtcars.ods", row_names = TRUE)
# append a sheet to an existing file
write_ods(PlantGrowth, "mtcars.ods", append = TRUE, sheet = "plant")
}