我试图将一个列表转换为向量,以便把它附加到数据框中,但是出现错误。在对列表进行解压缩后,它变得更短了,我不知道原因。感谢您的帮助,非常感谢。
> mongo_jr$last_state <- unlist(last_state)
Error in `$<-.data.frame`(`*tmp*`, "last_state", value = c("created", :
replacement has 203819 rows, data has 203823
> str(last_state)
List of 203823
x <- unlist(last_state)
> str(x)
chr [1:203819] "created" "created" "created" "created" "created" "created" "created" "created" ...
last_state
中的任何向量是否为空?运行table(sapply(last_state,length))
并查看其中是否混杂着长度为 0 的向量。 - Bishops_Guest