forked from ropensci/readODS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
129 lines (87 loc) · 4.65 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# readODS <img src="man/figures/read_ods_logo.png" align="right" height="200" />
<!-- badges: start -->
[![CRAN status](https://www.r-pkg.org/badges/version/readODS)](https://CRAN.R-project.org/package=readODS)
[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)
[![Codecov test coverage](https://codecov.io/gh/ropensci/readODS/branch/v2.1/graph/badge.svg)](https://app.codecov.io/gh/ropensci/readODS?branch=v2.1)
[![rOpenSci](https://badges.ropensci.org/302_status.svg)](https://github.com/ropensci/software-review/issues/386)
[![R-CMD-check](https://github.com/ropensci/readODS/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/ropensci/readODS/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->
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:
```r
install.packages("readODS")
```
from R-universe:
```r
install.packages("readODS", repos = "https://ropensci.r-universe.dev")
```
Or install the development version from Github:
```r
remotes::install_github("ropensci/readODS")
```
## Usage
In almost all use cases, you only need two functions: `read_ods` and `write_ods`. Simple.
#### Reading
```{r}
library(readODS)
read_ods("starwars.ods")
```
Reading from the 2nd sheet
```{r}
read_ods("starwars.ods", sheet = 2)
```
Reading from a specific range
```{r}
read_ods("starwars.ods", sheet = 2, range = "A1:C11")
```
Reading as a dataframe
```{r}
read_ods("starwars.ods", range="Sheet1!A2:C11", as_tibble = FALSE)
```
#### Writing
```{r}
## preserve the row names
write_ods(mtcars, "mtcars.ods", row_names = TRUE)
```
Appending a sheet
```{r}
write_ods(PlantGrowth, "mtcars.ods", append = TRUE, sheet = "plant")
```
```{r}
## Default: First sheet
read_ods("mtcars.ods")
```
```{r}
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)](https://wiki.documentfoundation.org/Faq/Calc/022) and Excel [(<=2003)](https://support.microsoft.com/en-gb/office/use-excel-with-earlier-versions-of-excel-2fd9ffcb-6fce-485b-85af-fecfd651a5ac#:~:text=What%20it%20means%20Beginning%20with,lost%20in%20Excel%2097%2D2003.) 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](https://wiki.documentfoundation.org/File:LibO6_MIME.svg). 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](https://creativecommons.org/licenses/by-sa/3.0/).
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.
* Fork the source code, modify, and issue a [pull request](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request-from-a-fork).
* Issues, bug reports: [File a Github issue](https://github.com/ropensci/readODS).
Please note that this package is released with a [Contributor Code of Conduct](https://ropensci.org/code-of-conduct/). By contributing to this project, you agree to abide by its terms.
```{r, include = FALSE}
unlink("mtcars.ods")
```