Re: [R] odd error

From: Marc Schwartz <MSchwartz_at_mn.rr.com>
Date: Sun 11 Dec 2005 - 03:09:21 EST

On Sat, 2005-12-10 at 14:44 +0000, IAIN GALLAGHER wrote:
> Hi All.
>
> I am getting a rather odd error using R 2.2.0 on Suse
> Linux 10. I write R scripts in the text editor Kate
> and then execute them using e.g
>
> >source ("timecourse_il4.r")
>
> in R. I have been moving these scripts between a linux
> box and a Mac and for that reason have a line
>
> quartz(display="", width=7, height=7)# set quartz
> graphics window size for linux change this to X11
>
> in my script. Now to run this on the linux box I
> either comment this line out i.e.
>
> #quartz(display="", width=7, height=7)# set quartz
> graphics window size for linux change this to X11
>
> or change the "quartz" to "X11".
>
> However when I run the script I get the following:
>
> Warning messages:
> 1: quartz() device interactivity reduced without an
> event loop manager in: quartz(display = "", width = 7,
> height = 7)
> 2: Quartz device not available on this platform
>
>
> I can work around this but wondered if anyone else was
> having a similar problem. I don't actually think it's
> a R problem but nontheless saving, closing and
> re-opening the altered (i.e. lines commented out or
> changed) file in Kate opens a file as it should be
> (i.e. with changed line) but the problem in R still
> occurs.
>
> Cheers
>
> Iain

If you are moving the code between the two platforms, why not rewrite the device specific code segment so that it looks something like:

if (getOption("device") == "quartz")
{
  quartz(...)
} else {
  X11(...)
}

or perhaps:

if (.Platform$GUI == "AQUA")
{
  quartz(...)
} else {
  X11(...)
}

I have not used a Mac, so there may be a better (more consistent) approach to delineating the default graphics device in an interactive R session based upon OS. This would save you from having to edit the source code each time you go back and forth.

I am guessing that your initial error problem is perhaps related to something in the line wrapping of the code, where the call to quartz() on Linux is not being properly commented out and thus is actually called by the R interpreter.

HTH, Marc Schwartz



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sun Dec 11 03:17:30 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:41:35 EST