dat <- data.frame(a = c("row1", "row1", "row2", "row2", "row2"),
b = c("col1", "col2", "col1", "col3", "col4"),
val = 1:5)
cast_sparse(dat, a, b)
cast_sparse(dat, a, b, val)
Run the code above in your browser using DataLab