geom_text,“%up%崩溃r

时间:2015-04-11 19:01:37

标签: r ggplot2 expression plotmath geom-text

关于为什么会崩溃r的任何想法?理想情况下,我在向上箭头前面没有文字,一个空格是可以接受的,但这两个都是段落错误。

ggplot2是版本1.0.1。

library(ggplot2)
## Use suppressPackageStartupMessages to eliminate package startup messages.
df <- data.frame(x=1,y=1,label=".%up% y")  ### <-- this works
ggplot(df, aes(x,y,label=label)) +
       geom_point() + geom_text(hjust=-1,parse=TRUE)
df <- data.frame(x=1,y=1,label=" %up% y")  ### <-- this crashes
ggplot(df, aes(x,y,label=label)) + 
       geom_point() + geom_text(hjust=-1,parse=TRUE)

 *** caught segfault ***
address 0xfffffffffffffff8, cause 'memory not mapped'
...

R> R.version  
               _                           
platform       x86_64-apple-darwin13.4.0   
arch           x86_64                      
os             darwin13.4.0                
system         x86_64, darwin13.4.0        
status                                     
major          3                           
minor          1.3                         
year           2015                        
month          03                          
day            09                          
svn rev        67962                       
language       R                           
version.string R version 3.1.3 (2015-03-09)
nickname       Smooth Sidewalk             
R>

编辑:在评论中添加以下要求:

(buzz 506) $ r
R> library(ggplot2)
R> df <- data.frame(x=1,y=1,label=".%up% y")  ### <-- this works
R> ggplot(df, aes(x,y,label=label)) + 
+        geom_point() + geom_text(hjust=-1,parse=TRUE)
R> df <- data.frame(x=1,y=1,label=" %up% y")  ### <-- this crashes
R> ggplot(df, aes(x,y,label=label)) + 
+        geom_point() + geom_text(hjust=-1,parse=TRUE)

 *** caught segfault ***
address 0xfffffffffffffff8, cause 'memory not mapped'

Traceback:
 1: .Call("plyr_loop_apply", PACKAGE = "plyr", n, f)
 2: loop_apply(n, do.ply)
 3: llply(.data = pieces, .fun = .fun, ..., .progress = .progress,     .inform = .inform, .parallel = .parallel, .paropts = .paropts)
 4: dlply(layer_data, "PANEL", function(df) {    panel_i <- match(df$PANEL[1], panel$layout$PANEL)    layer$make_grob(df, scales = panel$ranges[[panel_i]], cs = plot$coord)}, .drop = FALSE)
 5: (function (layer, layer_data) {    if (nrow(layer_data) == 0)         return()    dlply(layer_data, "PANEL", function(df) {        panel_i <- match(df$PANEL[1], panel$layout$PANEL)        layer$make_grob(df, scales = panel$ranges[[panel_i]],             cs = plot$coord)    }, .drop = FALSE)})(dots[[1L]][[2L]], dots[[2L]][[2L]])
 6: mapply(FUN = f, ..., SIMPLIFY = FALSE)
 7: Map(build_grob, plot$layer, data)
 8: ggplot_gtable(data)
 9: print.ggplot(list(data = list(x = 1, y = 1, label = 1L), layers = list(    <environment>, <environment>), scales = <S4 object of class "Scales">,     mapping = list(x = x, y = y, label = label), theme = list(),     coordinates = list(limits = list(x = NULL, y = NULL)), facet = list(        shrink = TRUE), plot_env = <environment>, labels = list(        x = "x", y = "y", label = "label")))
10: print(list(data = list(x = 1, y = 1, label = 1L), layers = list(    <environment>, <environment>), scales = <S4 object of class "Scales">,     mapping = list(x = x, y = y, label = label), theme = list(),     coordinates = list(limits = list(x = NULL, y = NULL)), facet = list(        shrink = TRUE), plot_env = <environment>, labels = list(        x = "x", y = "y", label = "label")))

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


(buzz 507) $ R
R> library(ggplot2)
R> sessionInfo()
R version 3.1.3 (2015-03-09)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10.2 (Yosemite)

locale:
[1] C

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

other attached packages:
[1] ggplot2_1.0.1

loaded via a namespace (and not attached):
 [1] MASS_7.3-40      Rcpp_0.11.5      colorspace_1.2-6 digest_0.6.8     grid_3.1.3       gtable_0.1.2     labeling_0.3    
 [8] munsell_0.4.2    plyr_1.8.1       proto_0.3-10     reshape2_1.4.1   scales_0.2.4     stringr_0.6.2   
R>

0 个答案:

没有答案