我正在尝试将列表转换为向量,因此我可以将其附加到数据帧但是它会引发错误。在将列表取消列出后,它变得更短,我不确定原因。
谢谢,非常感谢任何帮助。
> 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" ...
答案 0 :(得分:4)
事实证明,有些值为null
transition_duration[sapply(last_state, is.null)] <- NA
mongo_jr$last_state <- unlist(last_state)
的工作。