[R] Bug in bitmap producing pdf???

BXC (Bendix Carstensen) bxc at novonordisk.com
Fri Dec 15 16:39:34 CET 2000


I thought I was clever.
I produce both ps and pdf files from LaTeX (MiKTeX), so
sometimes I need to get .eps graphs from R, sometmes .pdf.

To rationalize this I wrote the following function to let me
easily choos what I want wihtou changing the code in my
R-programs too much (here embedded in a small test program):

plt <- 
function( file,
          type = "pdf",
           dir = options()$grdir,
        height = 7,
         width = 7,
         paper = "special",
           ... ) 
{
if ( type=="pdf" )
{
print ( paste( dir, file, ".pdf", sep="" ) ) #just cheking...
   bitmap( file = paste( dir, file, ".pdf", sep="" ),
           type = "pdfwrite",
         height = height,
          width = width,
            ... )
}

if ( type=="eps" )
{
print ( paste( dir, file, ".eps", sep="" ) ) #just checking...
   postscript( file = paste( dir, file, ".eps", sep="" ),
             height = height,
              width = width,
         horizontal = F,
              paper = paper,
                ... )
}
par( mgp=c(2,0.7,0) )
}

# If not set plots will be in pdf-format
 options( grdir="../eps/" )

pl.type <- "eps"  
plt( file="ar", pl.type )
plot(1,1) 

pl.type <- "pdf"  
plt( file="ar", pl.type )
plot(1,1) 

But what I get is:

> version
         _         
platform Windows   
arch     x86       
os       Win32     
system   x86, Win32
status             
major    1         
minor    1.1       
year     2000      
month    August    
day      15        
language R         
> source("xx.r") # This is where the above code is
[1] "../eps/ar.eps"
[1] "../eps/ar.pdf"
Error in tempfile("Rbit") : cannot find unused tempfile name
> 

The error comes with the pdf-bit even if I interchange the two 
parts doing the different kinds of files.

Any clues??

----------------------
Bendix Carstensen
Senior Statistician
Steno Diabetes Centre
Niels Steensens Vej 2
DK-2820 Gentofte
Denmark
tel: +45 44 43 87 38
mob: +45 28 25 87 38
fax: +45 44 43 73 13
bxc at novo.dk
www.biostat.ku.dk/~bxc
----------------------

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


More information about the R-help mailing list