POPMUISE
R基地,unstackunstack(df, V3 ~ V2)# a b c# 1 1 2 3# 2 3 3 2这可能不是一个通用的解决方案,但在这种情况下效果很好。数据df<-structure(list(V1 = structure(c(1L, 1L, 1L, 2L, 2L, 2L), .Label = c("x", "y"), class = "factor"),
V2 = structure(c(1L, 2L, 3L, 1L, 2L, 3L), .Label = c("a", "b", "c"), class = "factor"),
V3 = c(1L, 2L, 3L, 3L, 3L, 2L)), .Names = c("V1", "V2", "V3"), class = "data.frame", row.names = c(NA, -6L))