[R] PDF help for linux

From: Feng Li <m_at_feng.li>
Date: Tue, 19 Apr 2011 11:23:57 +0200


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/

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Tue 19 Apr 2011 - 09:27:09 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 19 Apr 2011 - 09:50:30 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive