且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

尝试写入表时未实现的类型列表

更新时间:2022-12-05 17:33:56

如评论中所述,您应该能够执行以下操作(未经测试)将您的列表展平到一个字符向量中:

As mentioned in the comments, you should be able to do something like this (untested) to get "flatten" your list into a character vector:

output$Title <- vapply(output$Title, paste, collapse = ", ", character(1L))

也如前所述,如果您想尝试 unlist 方法,则可以通过 output $ Title ,类似这样:

As also mentioned, if you wanted to try the unlist approach, you could "expand" each row by the individual values in output$Title, something like this:

x <- vapply(output$Title, length, 1L)          ## How many items per list element
output <- output[rep(rownames(output), x), ]   ## Expand the data frame
output$Title <- unlist(output$Title, use.names = FALSE)  ## Replace with raw values