【发布时间】:2020-02-12 19:24:04
【问题描述】:
拥有这个数据框
df <- structure(list(date = c("2008-07-31", "2008-08-04"), id = c(1L,
1L), body = list("text 2 and here another",
c("another text here",
"and this in the same row",
"one more in the same row"
))), row.names = 1:2, class = "data.frame")
如何取消列出 body 列以获得如下输出:
date id body 1 2008-07-31 1 text 2 and here another 2 2008-08-04 1 another text here and this in the same row one more in the same row
我试过这个:
df$body <- as.data.frame(unlist(df$body))
【问题讨论】:
-
@tmfmnk 你看到了打印选项。第一个有逗号。我尝试转换的输出是
data.frame(date = c("2008-07-31", "2008-08-04"), id = c(1, 1), body = c("text 2 and here another", "another text here and this in the same row one more in the same row")) -
这能回答你的问题吗? How do you paste list of items in R
标签: r