Learn R Programming

readODS (version 1.8.0)

write_ods: Write Data to ODS File

Description

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,
  verbose = FALSE,
  overwrite = NULL
)

Value

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

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.

verbose

logical, if messages should be displayed. Default is FALSE.

overwrite

logical, deprecated.

Author

Detlef Steuer steuer@hsu-hh.de, Thomas J. Leeper thosjleeper@gmail.com, John Foster john.x.foster@nab.com.au, Chung-hong Chan chainsawtiney@gmail.com

Examples

Run this code
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")
}

Run the code above in your browser using DataLab