r - 在 R 中捕获段错误

标签 r

我收到了 caught segfault每次尝试从 ggplot2 运行任何绘图函数时都会出错包 (1.0.0)。我已经用 qplot 试过了, geom_dotplot , geom_histogram等。包中的数据(例如 diamondseconomics )工作得很好。

我在 Mac OS 10.9.4(最新版本)和 R 3.1.1(也是最新版本)上运行。我在使用标准 R GUI、RStudio 以及从命令行使用 R 时遇到相同的错误。该命令会显示默认图形设备(R GUI 和命令行的 Quartz),但也会显示终端错误。

library(ggplot2)
qplot(1:10)

给我错误:
*** caught segfault ***
address 0x18, cause 'memory not mapped'

Traceback:
 1: .Call("plyr_split_indices", PACKAGE = "plyr", group, n)
 2: split_indices(scale_id, n)
 3: scale_apply(layer_data, x_vars, scale_train, SCALE_X, panel$x_scales)
 4: train_position(panel, data, scale_x(), scale_y())
 5: ggplot_build(x)
 6: print.ggplot(list(data = list(), layers = list(<environment>),     scales = <S4 object of class "Scales">, mapping = list(x = 1:3),     theme = list(), coordinates = list(limits = list(x = NULL,         y = NULL)), facet = list(shrink = TRUE), plot_env = <environment>,     labels = list(x = "1:3", y = "count")))
 7: print(list(data = list(), layers = list(<environment>), scales = <S4 object of class "Scales">,     mapping = list(x = 1:3), theme = list(), coordinates = list(        limits = list(x = NULL, y = NULL)), facet = list(shrink = TRUE),     plot_env = <environment>, labels = list(x = "1:3", y = "count")))

Possible actions:

 1: abort (with core dump, if enabled)
 2: normal R exit
 3: exit R without saving workspace
 4: exit R saving workspace

这是我的 session 信息:
R version 3.1.1 (2014-07-10)
Platform: x86_64-apple-darwin13.1.0 (64-bit)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] graphics  grDevices utils     datasets  stats     methods   base     

other attached packages:
[1] ggplot2_1.0.0 marelac_2.1.3 seacarb_3.0   shape_1.4.1   beepr_1.1     birk_1.1     

loaded via a namespace (and not attached):
[1] audio_0.1-5      colorspace_1.2-4 digest_0.6.4     grid_3.1.1       gtable_0.1.2    
[6] MASS_7.3-34      munsell_0.4.2    plyr_1.8.1       proto_0.3-10     Rcpp_0.11.2     
[11] reshape2_1.4     scales_0.2.4     stringr_0.6.2    tools_3.1.1

我从其他人那里了解到这是某种内存问题,但即使我有超过 2 GB 的可用 RAM,也会发生此错误。我知道这是一个广泛使用的包,所以当然这不会发生在每个人身上,但为什么会发生在我身上?有谁知道我能做些什么来解决这个问题?

最佳答案

万一其他人将来遇到此问题或类似问题,我向软件包维护者发送了错误报告,他建议卸载所有已安装的软件包并重新开始。我接受了他的建议,并且奏效了!

我遵循了这个帖子的建议:http://r.789695.n4.nabble.com/Reset-R-s-library-to-base-packages-only-remove-all-installed-contributed-packages-td3596151.html

ip <- installed.packages()
pkgs.to.remove <- ip[!(ip[,"Priority"] %in% c("base", "recommended")), 1]
sapply(pkgs.to.remove, remove.packages)

关于r - 在 R 中捕获段错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25672974/

相关文章:

r - 系统打开 RStudio 关闭连接

r - ggraph 使填充的箭头边缘出现在图例中

r - 如何从 R 中的其他组中减去一组

r - 如何在 ggplot2 中使用一个点条目和一个线条目创建图例?

r - 在模拟中计算并绘制每一代的自举置信区间

r - 找出函数是在哪个版本的 R 中引入的

c - 在 C 中运行嵌入式 R

R ggplot2 具有 reshape (融化功能)选择性地绘制数据集

r - 使用 R 使两个 shapefile 相交

在 R 数据框中保留数值精度?