r语言 - 'dplyr::summarize()' 中的错误:计算时出现问题...由"sort.int()"中的错误导致:!x 必须是原子的



系统规格(运行在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数据帧报头:

<表类>Obs_idxIntMin是Maxtbody><<tr>Obs001"all"-0.2551.2422.487Obs001"(0.901,50.5),-0.2550.6141.554Obs001"(50.5,100]">1.1961.8702.487Obs002"all"

在评论中与@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版本进行诊断!

相关内容

最新更新