x <- expand.grid(age = c(0, 1, 2),
sex = c("F", "M"),
region = c("A", "B"),
year = 2000:2001)
x$count <- 1:24
to_matrix(x,
rows = c(age, sex),
cols = c(region, year),
measure = count)
to_matrix(x,
rows = c(age, sex, region),
cols = year,
measure = count)
## cells not uniquely identified
try(
to_matrix(x,
rows = age,
cols = sex,
measure = count)
)
Run the code above in your browser using DataLab