Dear R,
Usually when I want to read pdf help for R functions under Linux, I do
the following steps
> help("par",help_type="pdf")
> system(paste(getOption("pdfviewer"),"par.pdf"))
which works well. First question, can I let "help" to save the pdf
file to a different place other than current working directory?
Now I want to write a small function to do the above together.
> viewpdfhelp <- function(topic, reader =
getOption("pdfviewer"))
+ {
+ genpdf <- help(topic = topic, help_type = "pdf") # save pdf
file
+ pdffile <- paste(topic, ".pdf", sep = "") # the pdf
file name
+ system(paste(reader, pdffile)) #call the viewer
+ }>
> viewpdfhelp("options")
To my surprise "help" does not generate the pdf file at all this time.
Can someone tell me what's going wrong here? Many thanks!
> sessionInfo()
R version 2.13.0 (2011-04-13)
Platform: x86_64-unknown-linux-gnu (64-bit)
locale:
[1] LC_CTYPE=en_US.utf8 LC_NUMERIC=C
[3] LC_TIME=en_US.utf8 LC_COLLATE=en_US.utf8
[5] LC_MONETARY=C LC_MESSAGES=en_US.utf8
[7] LC_PAPER=en_US.utf8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.utf8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] tools_2.13.0
--
Feng Li
Department of Statistics
Stockholm University
106 91 Stockholm, Sweden
http://feng.li/