系统规格(运行在HPC远程集群上,所以我无法更新R):
R version 3.6.0 (2019-04-26) -- "Planting of a Tree"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-conda_cos6-linux-gnu (64-bit)
包装规格:
> packageVersion("dplyr")
[1] ‘1.0.8’
test_profile
数据帧报头:
在评论中与@akrun交谈后,我发现了问题的根源:当尝试做test_profile <- rbind(df1, df2) %>% as.data.frame()
时,R 3.6.0
中的奇怪行为。如果我将其替换为test_profile <- bind_rows(df1, df2)
,则不会出现此问题。
在R 4.1.2
中,当使用base
函数如rbind
时,似乎更容易处理tbl_df
类型;然而在R 3.6.0
中,当使用rbind
时,我们最终得到一个包含列表列的数据帧。
我将把它留在这里,因为正如@akrun指出的那样,我们应该始终使用匹配的包和R版本进行诊断!