knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

readODS

CRAN status Lifecycle: stable Codecov test coverage rOpenSci R-CMD-check

The only goal of readODS is to enable R to read and write OpenDocument Spreadsheet (ODS) files. This package supports both ordinary ODS and "Flat ODS" (fods).

Installation

Install the latest stable version from CRAN:

install.packages("readODS")

from R-universe:

install.packages("readODS", repos = "https://ropensci.r-universe.dev")

Or install the development version from Github:

remotes::install_github("ropensci/readODS")

Usage

In almost all use cases, you only need two functions: read_ods and write_ods. Simple.

Reading

library(readODS)
read_ods("starwars.ods")

Reading from the 2nd sheet

read_ods("starwars.ods", sheet = 2)

Reading from a specific range

read_ods("starwars.ods", sheet = 2, range = "A1:C11")

Reading as a dataframe

read_ods("starwars.ods", range="Sheet1!A2:C11", as_tibble = FALSE)

Writing

## preserve the row names
write_ods(mtcars, "mtcars.ods", row_names = TRUE)

Appending a sheet

write_ods(PlantGrowth, "mtcars.ods", append = TRUE, sheet = "plant")
## Default: First sheet
read_ods("mtcars.ods")
read_ods("mtcars.ods", sheet = "plant", range = "A1:B10")

Maximum Sheet Size

Reading The maximum size of sheet you can read is determined by your machine's RAM.

Writing You can theoretically write sheets up to 16 384 columns by 1 048 576 rows (the current maximum sheet size in Excel and LibreOffice Calc). While larger ODS files than this are valid, they are not well supported. However older version of LibreOffice (<=7.3) and Excel (<=2003) have significantly smaller maximum sheet sizes, and so this should be considered when writing files for distribution.

Misc

The logo of readODS is a remix of LibreOffice Calc v6.1 icon created by the Document Foundation. The original LibreOffice logo is licensed under the Creative Commons Attribution Share-Alike 3.0 Unported License. readODS is not a product of the Document Foundation. The logo of readODS is licensed under the Creative Commons Attribution Share-Alike 3.0 Unported License.

The creator of this package is Gerrit-Jan Schutten. The current maintainer is Chung-hong Chan. This package benefits from contributions by Peter Brohan, Thomas J. Leeper, John Foster, Sergio Oller, Jim Hester, Stephen Watts, Arthur Katossky, Stas Malavin, Duncan Garmonsway, Mehrad Mahmoudian, Matt Kerlogue, Detlef Steuer, Michal Lauer, and Till Straube.

This package emulates the behaviours of readxl::read_xlsx, writexl::write_xlsx and xlsx::write.xlsx.

This package should be a silent member of rio, so that you don't need to care about file format any more.

License

GPL3

Contributing

Contributions in the form of feedback, comments, code, and bug report are welcome.

Please note that this package is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

unlink("mtcars.ods")


phonixor/readODS documentation built on April 19, 2024, 9:50 p.m.