From ripley at stats.ox.ac.uk  Sat Jan 15 08:59:24 2011
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Sat, 15 Jan 2011 07:59:24 +0000 (GMT)
Subject: [Rd] How to point R toward Ghostscript on a Windows XP system
In-Reply-To: <249211.68732.qm@web161805.mail.bf1.yahoo.com>
References: <249211.68732.qm@web161805.mail.bf1.yahoo.com>
Message-ID: <alpine.LFD.2.00.1101150749170.3738@gannet.stats.ox.ac.uk>

On Fri, 14 Jan 2011, Jeremy Koster wrote:

> A colleague designed a script for a bar plot, which I'd like to 
> export to my directory via the barplot command:
>
> bitmap(file="barplot.tif", type="tifflzw", height=4, width=6.5, res=1250)
>
> Unfortunately, this command produces the following error message:
>
> Error in system(paste(gsexe, "-help"), intern = TRUE, invisible = TRUE) :
>  'gswin32c.exe' not found
>
>> From consulting the archives and the help file, I deduced that I 
>> needed to install Ghostscript, which I did.  Subsequent messages in 
>> the archives suggest directing R toward Ghostscript using an 
>> environmental variable, specifically R_GSCMD.

Please do read the help page.  You didn't tell us if you added 
Ghostscript to your path: if you had done so this would not be needed 
(as the help page says).

> Unfortunately, I haven't figured out how to use this command.  Can 
> anyone provide assistance?

Sys.setenv(GS_CMD="C:/Program Files/gs/gswin32c.exe")
if what you say below is correct, but
Sys.setenv(GS_CMD="C:/Program Files/gs/bin/gswin32c.exe")
would be more standard for recent versions of Ghostscript.

> This is for R version 2.12.0 using Windows XP on a Dell laptop.

OK, but next time please consult the posting guide and give us the 
'at a minimum' information asked for there (we need to know if this is 
32- or 64-bit Windows on a 32- or 64-bit OS -- and although rare, 
64-bit Windows XP does exist).

> The path for ghostscript in my program files folder is: C:\Program 
> Files\gs
>
> Many thanks,
> Jeremy
> UC Anthropology

BTW, asking how to set environment variables is covered in the rw-FAQ 
and is not an R-devel topic.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



[Rd] How to point R toward Ghostscript on a Windows XP system
Prof Brian Ripley