Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有办法dcast输出一个小标题?(不使用as_tibble)
dcast
as_tibble
df <- tibble(a = letters[c(rep(1:3, 3), 1)], b = 1:10 + .1, c = 11:20 + .1) df %>% class # [1] "tbl_df" "tbl" "data.frame" df %>% dcast(a ~ b) %>% class # [1] "data.frame"
该reshape2软件包已停用,不太可能更新以支持 tibbles。如果你想坚持使用 tibbles,你应该使用reshape2名为tidyr. 您可以使用
reshape2
tidyr
library(tidyr) df %>% spread(b, c)