[R] [Rd] An issue happens Embed R and redirt png file
dna_jin at hotmail.com
Thu Jun 5 07:32:26 CEST 2008
My R version is R 2.7.0, but the png still can not be used when I embed R in
Dirk Eddelbuettel wrote:
> Wrong list, so re-directing to r-help. Consider r-sig-debian for Debian
> questions too, but subscribe or else your posts bounce.
> On 4 June 2008 at 07:18, Rongrong wrote:
> | I am a new R user and I have a question of embedding R to generate png
> | On Debian, I installed R by source code.
> | Now I want to embed R in an application which name is MyApp, and run
> | the following syntax:
> | png(filename="/tmp/Rplot%03d.png)
> | example(rect)
> | dev.off()
> | Unfortunately I get the following error message:
> | Error in X11(paste("png::", filename, sep = ""), width, height,
> | :
> | unable to start device PNG
> | Calls: png
> | In addition: Warning message:
> | In png(filename = "/tmp/test%03d.png") :
> | unable to open connection to X11 display ''
> See the R FAQ.
> | But I could run above syntax from R, and the result is correct, I can
> | two png files from /tmp/ folder.
> | I try to respectively run same syntax(the syntax is:
> | capabilities()[["png"]])
> | under two modes, the result is different:
> | In R the result is TRUE, but when MyApp embed R the result is FALSE
> Because in case you have an x11 display, and in the other your don't. No
> display, no x11.
> | Then I used bitmap(file="/tmp/test") when embed R in MyApp, but get
> | error message:
> | Error in bitmap(file = "/tmp/test") : sorry, 'gs' cannot be found
> Fix that via
> $ sudo apt-get install ghostscript
> | Besides, I have installed xvfb. What I need do?
> Almost there. Wrap your call to MyApp in svfb-run, ie do
> $ xvfb-run MyApp [other parameters]
> and you get the virtual x11 device that png needs.
> R 2.7.0 should also alleviate the need for an x11 device due to its new
> cairo-based device code. While you didn't tell as which R version you are
> running, I suspect it is not the one the current one.
> Three out of two people have difficulties with fractions.
> R-help at r-project.org mailing list
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
View this message in context: http://www.nabble.com/Re%3A--Rd---An-issue-happens-Embed-R-and-redirt-png-file-tp17653928p17662473.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help