Write the tables of run_monitor() as one Excel workbook, with a colour
scale on every wide sheet, or as CSV files.
write_monitor_tables(
x,
path,
format = c("xlsx", "csv"),
file = "monitor",
verbose = 1
)Result of run_monitor().
Folder to write to (created if needed).
"xlsx" (default; needs the openxlsx package) or
"csv".
File name without extension (xlsx) or prefix of the file
names (csv). Default "monitor".
0 (silent) or 1 (summary, default).
Invisibly, the path(s) of the written file(s).
The workbook has the long tables Alerts, Stations, Houses, Pigs
(the pig_summary of run_monitor()) and Pig days, and wide sheets
(see wide_table()) with a colour scale from red (a possible problem)
over yellow to green:
| Sheet | Values | Red for |
Visits | visits per station and day | low |
Unidentified pct | unidentified visits, % | high |
Feed kg | feed intake per station | low |
Feed per pig kg | feed intake per pig | low |
Occupation h | occupation time | low |
Weight outliers pct | body weight outliers, % | high |
House feed per pig kg | feed intake per pig and house | low |
House weight kg | mean body weight per house | (blue scale) |
Pig feed kg | feed intake per pig and day | low |
Hours visits, Hours feed kg | per hour of the last day | (blue scale) |
The CSV files are the long tables <file>_alerts.csv,
<file>_stations.csv, <file>_houses.csv, <file>_pigs.csv,
<file>_pig_days.csv and <file>_hours.csv, written with a byte order
mark so that Excel opens them in UTF-8.
mon <- run_monitor(tidypptsda::nedap, verbose = 0)
dir <- file.path(tempdir(), "monitor_tables")
write_monitor_tables(mon, dir, format = "csv")
#> ✔ Wrote 6 CSV files to /tmp/RtmpBRLQC3/monitor_tables
if (requireNamespace("openxlsx", quietly = TRUE)) {
write_monitor_tables(mon, dir)
}
#> ✔ Wrote /tmp/RtmpBRLQC3/monitor_tables/monitor.xlsx (16 sheets)
unlink(dir, recursive = TRUE)
mon <- run_monitor(tidypptsda::nedap, verbose = 0)
dir <- file.path(tempdir(), "monitor_tables")
write_monitor_tables(mon, dir, format = "csv")
#> ✔ Wrote 6 CSV files to /tmp/RtmpBRLQC3/monitor_tables
unlink(dir, recursive = TRUE)