我收到了 caught segfault
每次尝试从 ggplot2
运行任何绘图函数时都会出错包 (1.0.0)。我已经用 qplot
试过了, geom_dotplot
, geom_histogram
等。包中的数据(例如 diamonds
或 economics
)工作得很好。
我在 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/