[R] Save pdf to a relative directory?
someone
vonhoffen at t-online.de
Thu May 6 21:06:12 CEST 2010
hi there
im having a R script in which i produce soe plots that are saved to a pdf
specified by an absolute path...
Is there a way to specify a relative path instead?
pdfPlot("/Users/XXX/Desktop/R_script/plots/plot1", 8, 6, function(){
plot_plot1(data)
})
this is what I am doing at the moment but this will obviously just work on
my machine.
pdfPlot <- function(file, width, height, fun, png=FALSE){
# plots are saved to a PDF, parameters are listed
# output file location, width, height, function to be plotted
# e.g. pdfPlot("C:/..", 6, 5, function(){ ... })
pdf(paste(file, ".pdf", sep=""), width=width, height=height)
fun()
dev.off()
if (png){
png(paste(file, ".png", sep=""), width=width*100, height=height*100)
fun()
dev.off()
}
}
this is the plotting function...
could anyone help me out and let me know how i could save the pdf to
"workingdirectory"/plots/?
--
View this message in context: http://r.789695.n4.nabble.com/Save-pdf-to-a-relative-directory-tp2133206p2133206.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list