Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
198 views
in Technique[技术] by (71.8m points)

caught segfault error in R

I am getting a caught segfault error every time I try to run any plotting functions from the ggplot2 package (1.0.0). I have tried this with qplot, geom_dotplot, geom_histogram, etc. Data from the package (e.g. diamonds or economics) work just fine.

I am operating on Mac OS 10.9.4 (the latest version) and on R 3.1.1 (also the latest version). I get the same error with the standard R GUI, RStudio, and when using R from the command line. The command brings up the default graphic device (Quartz for R GUI and command line), but also the terminal error.

library(ggplot2)
qplot(1:10)

gives me the error:

*** 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

Here is my session info:

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

I've gathered from others that this is a memory issue of some sort, but this error occurs even when I have over 2 GB of free RAM. I know this is a widely used package, so of course this doesn't happen for everyone, but why is it happening for me? Does anyone know what I can do to fix this problem?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

In case anyone else has this problem or similar in the future, I sent a bug report to the package maintainer and he recommended uninstalling all installed packages and starting over. I took his advice and it worked!

I followed advice from this posting: 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)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...