(input <- tabs2shift$messy_rows)
# select rows where there is 'unit 2' in column 1 or 'year 2' in column 2
schema <-
setFilter(rows = .find(pattern = "unit 2", col = 1)) %>%
setFilter(rows = .find(pattern = "year 2", col = 2), operator = `|`) %>%
setIDVar(name = "territories", columns = 1) %>%
setIDVar(name = "year", columns = 2) %>%
setIDVar(name = "commodities", columns = 3) %>%
setObsVar(name = "harvested", columns = 5) %>%
setObsVar(name = "production", columns = 6)
reorganise(schema = schema, input = input)
Run the code above in your browser using DataLab