我有这些数据:
structure(list(type = c("journal", "all", "similar_age_1m", "similar_age_3m",
"similar_age_journal_1m", "similar_age_journal_3m"), count = c("13972",
"754555", "22408", "56213", "508", "1035"), rank = c("13759",
"754043", "22339", "56074", "459", "947"), pct = c("98.48", "99.93",
"99.69", "99.75", "90.35", "91.50")), .Names = c("type", "count",
"rank", "pct"), row.names = c(NA, -6L), class = "data.frame")
我想把它变成一行,列的名称2:4
以相应的类型为前缀。例如journal.count
,journal.rank
...最快的方法是什么?出于某种原因dcast
,并reshape
没有为我做这件事,我的解决方案有点太麻烦了。