# build a schema for an already tidy table
(tidyTab <- tabs2shift$tidy)
schema <-
setIDVar(name = "territories", col = 1) %>%
setIDVar(name = "year", col = .find(pattern = "period")) %>%
setIDVar(name = "commodities", col = 3) %>%
setObsVar(name = "harvested", col = 5) %>%
setObsVar(name = "production", col = 6)
# before ...
schema
# ... after
validateSchema(schema = schema, input = tidyTab)
Run the code above in your browser using DataLab