Four Small TidyPanel Examples

The four bundled CSV files are fictional examples with three input rows each. They contain no personal records or development datasets.

Numbers

numbers <- read_messy_panel(system.file(
  "extdata", "demo_01_numbers.csv", package = "TidyPanel", mustWork = TRUE
))
numbers
#>   record_code   item amount
#> 1         001 Item A 1200.5
#> 2         002 Item B -250.0
#> 3         003 Item C     NA

The record codes keep their leading zeros. The amount column becomes numeric, including a negative amount and a missing value.

Dates

dates <- read_messy_panel(system.file(
  "extdata", "demo_02_dates.csv", package = "TidyPanel", mustWork = TRUE
))
dates
#>   record_code       date reading
#> 1         001 2024-01-01    10.5
#> 2         002 2024-01-02    12.0
#> 3         003 2024-01-03      NA

The date column becomes a Date column. A missing reading stays missing.

Subtotals And Periods

panel <- read_messy_panel(
  system.file(
    "extdata", "demo_03_subtotals.csv", package = "TidyPanel", mustWork = TRUE
  ),
  auto_pivot = TRUE,
  return_audit = TRUE
)
panel$data
#>     item time_period value
#> 1 Item A        2023    10
#> 2 Item B        2023    20
#> 3 Item A        2024    12
#> 4 Item B        2024    24
panel$audit
#>                       Operation Count
#> 1 Mid-Table Subtotals Amputated     1
#> 2       Auto-Pivot Wide to Long     2

The total row is excluded and the two yearly columns become a long table.

Caller-Declared Missing Tokens

missing_tokens <- read_messy_panel(
  system.file(
    "extdata", "demo_04_missing_tokens.csv", package = "TidyPanel", mustWork = TRUE
  ),
  na_strings = "MISSING"
)
missing_tokens
#>   record_code         item reading count
#> 1        F001 Widget Amber    6.75     2
#> 2        F002  Widget Teal      NA     4
#> 3        F003  Widget Rose    0.00     1

The fictional token MISSING becomes a missing reading because it is explicitly declared. The zero reading stays zero, and record codes remain literal text. Choose missing markers from your own source’s definitions, not this example.

Agents can run Rscript --vanilla exec/tidypanel.R describe to obtain all four example request templates, including their installed input paths and options. Choose a new output directory for each job; example discovery creates no files.

For your own table, supply its file path instead of a bundled example.