Ingests a multi-table dataset into a named list of data frames, ready
for mask_set(). Three input shapes are accepted:
Details
- a folder path
Every
.csv,.tsv, and.fstfile in the folder becomes one table, named by its file name (without extension). CSV / TSV are read withdata.table::fread();.fstneeds the Suggestedfstpackage.- an Excel workbook (
.xlsx/.xls) Every sheet becomes one table, named by its sheet name. Needs the Suggested
readxlpackage.- a named list of data frames
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.
Examples
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)
#> $plots
#> site yield
#> 1 A 3.1
#> 2 B 4.2
#>
#> $sites
#> site rainfall
#> 1 A 400
#> 2 B 550
#>