安装/使用 Cairo / R 2.12.1 的困难

发布于 2024-10-15 15:30:56 字数 990 浏览 2 评论 0原文

我为我的系统(CentOS)编译了R版本2.12.1(2010-12-16),然后安装了Cairo_1.4-5。

当我批量调用我的脚本时,我想使用 Cairo 生成图形的 PNG(也可能是 PDF)输出,但这在我使用 X 时给我带来了困难(我通过 ssh 隧道传输 X,它经常在 R 时断开连接)脚本正在运行...),所以这就是我想使用开罗的原因。

(顺便说一句,我没有 root 访问权限)。

虽然它是根据 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

,但我无法调用 CairoPDF:

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

奇怪的是,我可以调用名为 cairo_pdf 的函数

> cairo_pdf()
> 

我无法调用 CairoPNG、cairo_PNG 或 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"

我的安装有问题吗?坦率地说,我不知道如何从这里继续,为什么我什至不能调用 CairoPNG()?

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()?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

阳光①夏 2024-10-22 15:30:56

在 Ubuntu 上我有:

> 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     

然后运行库(Cairo),如果没有安装

图书馆(开罗)
库错误(Cairo):没有名为“Cairo”的包

这意味着您必须安装 Cairo R 包,它与 Cairo 图形系统交互

> install.packages('Cairo')

它将下载、构建和安装该包 - 您不需要 root 话

如果成功的

>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

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

梦里寻她 2024-10-22 15:30:56

这应该做:

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

This should do:

install.packages("Cairo")
library(Cairo)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文