| read_set | R Documentation |
Ingests a multi-table dataset into a named list of data frames, ready
for mask_set(). Three input shapes are accepted:
read_set(input, sheets = NULL, pattern = NULL)
input |
A folder path, an |
sheets |
For an Excel workbook, an optional character vector of
sheet names to read (default: all sheets). Any other input with
|
pattern |
For a folder, an optional regular expression to select
files (default: all |
Every .csv, .tsv, and .fst file in the
folder becomes one table, named by its file name (without
extension). CSV / TSV are read with data.table::fread(); .fst
needs the Suggested fst package.
.xlsx / .xls)Every sheet becomes one
table, named by its sheet name. Needs the Suggested readxl
package.
Returned as-is after validation.
Only clean rectangular tables are supported. A sheet or file that does
not read as a rectangle - missing header row (auto-named ...1
columns), zero rows, or zero columns - fails with an explanatory error
naming the offending table. masque does not attempt to recover
merged cells, multi-row headers, or junk rows; tidy the source first.
A named list of data.tables.
mask_set(), write_set().
tables <- list(
plots = data.frame(site = c("A", "B"), yield = c(3.1, 4.2)),
sites = data.frame(site = c("A", "B"), rainfall = c(400, 550))
)
read_set(tables)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.