In the R database, you can use reshape():
reshape(mydf, direction = "wide", idvar = c("A", "B"), timevar = "C")
You can also use tidyrand dplyrtogether, for example:
library(dplyr)
library(tidyr)
mydf %>% group_by(A, B) %>% spread(C, D)
source
share