read_ods_multsheets: A wrapper around read_ods to read multiple sheets in a .ods...

View source: R/read_ods_multsheets.R

read_ods_multsheetsR Documentation

A wrapper around read_ods to read multiple sheets in a .ods file

Description

Read in multiple sheets in a .ods file.

Usage

read_ods_multsheets(path)

Arguments

path

Path to the .ods file to import.

Details

Currently, read_ods will only read one sheet at a time. read_ods_multsheets can handle multiple sheets in one .ods workbook, or, when used with list.files and lapply, multiple workbooks with multiple sheets.

The result is a named list of data frames, with the sheet name appended to the basename of the filename with the file extension removed.

Value

A list of data frames–one data frame for each sheet.

See Also

Other readin functions: list_sheetnames(), read_excelsheet(), read_header(), read_multsheets(), read_sheets()

Examples

## Not run: 
write_ods(iris[iris$Species=="setosa",], "iris.ods", sheet = "setosa")

write_ods(iris[iris$Species=="versicolor",], "iris.ods",
          sheet = "versicolor", append = TRUE)

write_ods(iris[iris$Species=="virginica",],
          "iris.ods", sheet = "virginica", append = TRUE)

read_ods_multsheets("iris.ods")

# Read multiple files with multiple sheets
files <- list.files(data_folder, recursive = TRUE, pattern = "*.ods")

# Use lapply() with the result of list.files
lapply(files, read_ods_multsheets)

## End(Not run)

IdahoAgStats/facthelpeR documentation built on Jan. 29, 2024, 9:22 a.m.