开发者

difficulties with installing/using Cairo / R 2.12.1

I have compiled R version 2.12.1 (2010-12-16) for my system (CentOS), and afterwards I installed Cairo_1.4-5.

I'd like use Cairo to produce PNG (and maybe PDF) output of my graphs when I batch-invoke my scripts, but this gives me difficulties when I am using X (I am tunneling X through ssh and it often disconnects while the R scripts are running...), so this is why I want to use Cairo.

(I do not have root access btw).

Although it's installed according to sessionInfo

> sessionInfo()
R version 2.12.1 (2010-12-16)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
[1] C

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

I can not call CairoPDF:

> CairoPDF()
Error: could not find function "CairoPDF"

Weirdly, I can invoke a function called cairo_pdf

> cairo_pdf()
> 

I can not call CairoPNG, cairo_PNG or cairo_png:

> CairoPNG()
Error: could not find function "CairoPNG"
> cairo_PNG()
Error: could not find function "cairo_PNG"
> cairo_png()
Error: could not find function "cairo_png"

Is something wrong withmy installation? 开发者_如何学编程Frankly I have no idea how to proceed from here, why can't I even call CairoPNG()?


On Ubuntu I have:

> sessionInfo()
R version 2.12.1 (2010-12-16)
Platform: i486-pc-linux-gnu (32-bit)

locale:
 [1] LC_CTYPE=af_ZA.utf8       LC_NUMERIC=C             
 [3] LC_TIME=af_ZA.utf8        LC_COLLATE=af_ZA.utf8    
 [5] LC_MONETARY=C             LC_MESSAGES=af_ZA.utf8   
 [7] LC_PAPER=af_ZA.utf8       LC_NAME=C                
 [9] LC_ADDRESS=C              LC_TELEPHONE=C           
 [11] LC_MEASUREMENT=af_ZA.utf8 LC_IDENTIFICATION=C      

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

Then run library(Cairo), if this is not installed

library(Cairo)
Error in library(Cairo) : there is no package called 'Cairo'

This means you will have to install the Cairo R package, which interfaces with the Cairo graphics system

> install.packages('Cairo')

It will download, build and install the package - you don't need root for this

If it was successful, you can run

>library(Cairo)
>sessionInfo()
R version 2.12.1 (2010-12-16)<br>
Platform: i486-pc-linux-gnu (32-bit)

locale:
 [1] LC_CTYPE=af_ZA.utf8       LC_NUMERIC=C             
 [3] LC_TIME=af_ZA.utf8        LC_COLLATE=af_ZA.utf8    
 [5] LC_MONETARY=C             LC_MESSAGES=af_ZA.utf8   
 [7] LC_PAPER=af_ZA.utf8       LC_NAME=C                
 [9] LC_ADDRESS=C              LC_TELEPHONE=C           
 [11] LC_MEASUREMENT=af_ZA.utf8 LC_IDENTIFICATION=C      

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

other attached packages:
[1] Cairo_1.4-5

HTH


This should do:

install.packages("Cairo")
library(Cairo)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜