I have a dataset like aa:
aa <- data_frame(month = c(1, 1, 2, 2),
type = c("most", "least", "most", "least"),
value = c(0.2, 0.8, 1, 0.1),
NP = c(4, 2, 0, 6),
NO = c(1, 5, 2, 4))
I want to go from long to wide FOR ALL VARIABLES but (month, type) like bb with a dataset with much more columns.
bb <- data_frame(month = c(1, 2),
value_most = c(0.2, 1),
value_least = c(0.8, 0.1),
NP_most = c(4, 0),
NP_least = c(2,6),
NO_most = c(1, 2),
NO_least = c(5, 4))
I have tried pivot_wider() and reshape() without success.
Any clue?