【发布时间】:2014-09-26 01:42:49
【问题描述】:
我有一个 2 列 100,000 行的数据框,如下所示:
Count String
3 "Hello World"
2 "Hi John"
1 "Dear Joe"
我想将此数据框重塑为 1 列数据框,删除计数并添加重复项。例如,
String
"Hello World"
"Hello World"
"Hello World"
"Hi John"
"Hi John"
"Dear Joe"
【问题讨论】:
-
t(t(with(df, rep(String, Count))))
标签: r dataframe reshape reshape2