On 24.08.2011 21:59, Tyler Rinker wrote:
Apparently my request to view the help pages
Well, although the questions we see on R-help suggest that some useRs do
not look at those help pages, most of us do, but in text or html mode
rather than the pdf version.
Best,
Uwe Ligges
is not a popular method among R users for gaining information. for me these
pages are very helpful so I will follow up to completed this thread for future
searchers.
First thanks fo Prof. Brian Ripley. Your idea was spot on what I was looking
for for generating a pdf from the package library.
I worked out the following code that I added to my .First() library:
#=============================================================================manual<-
function(library, method=web){
LIB<- substitute(library)
LIB<- as.character(LIB)
METH<- substitute(method)
METH<- as.character(METH)
switch(METH,
web =
browseURL(paste("http://cran.r-project.org/web/packages/",LIB,"/",LIB,".pdf", sep =
"")),
system = {unlink(paste(getwd(),"/",LIB,".pdf",sep=""))
path<- find.package(LIB)
system(paste(shQuote(file.path(R.home("bin"), "R")),"CMD",
"Rd2pdf",shQuote(path)))})
}
#=============================================================================
library is the package name
method is either web or system (web is Internet based and faster where as
system creates the pdf from the library latex code and is slower)
#=============================================================================
Thanks for your responses!
Tyler
Date: Wed, 24 Aug 2011 07:12:24 +0100
From: rip...@stats.ox.ac.uk
To: tyler_rin...@hotmail.com
CC: r-help@r-project.org
Subject: Re: [R] Opening package manual from within R
On Tue, 23 Aug 2011, Tyler Rinker wrote:
Simple question but searching rseek did not yield the results I wanted.
Question: Is there a way to open a help manual for a package from within R.
For instance I would like to type a function in r for the tm package
and R would open that PDF as seen here:
http://cran.r-project.org/web/packages/tm/tm.pdf
-The vignette function exists for vignettes
[vignette("package.name")] so I assume the same exists for manuals.
You assume wrong. Vignettes PDFs are installed as part of the package
(and often take minutes to regenerate): the PDF version of the help
pages (what you seem to call 'the package manual') is not (in
general). In many cases what other people (including the author, e.g.
me for RODBC) call the 'package manual' is a PDF in the doc directory
(which may or may not be a vignette).
The assumption is that people will use search facilities or the hints
given by the help titles in help(package="tm") or browse the HTML
version of the same information (e.g. via help.start).
But you can (provided you have pdflatex etc in your path) generate the
PDF version of the help pages by
R CMD Rd2pdf /path/to/installed/package
It will even open it in a browser for you (unless you use
--no-preview). You could easily encapsulate this in a function by
e.g.
showPDFmanual<- function(package, lib.loc=NULL)
{
path<- find.package(package, lib.loc)
system(paste(shQuote(file.path(R.home("bin"), "R")),
"CMD", "Rd2pdf",
shQuote(path)))
}
Alternatively *for packages on CRAN only* you can access the version
on CRAN by browseURL.
-I do not want library(help="package.name") as this is not detailed enough.
I am running R 2.14.0 beta on a windows 7 machine
Reproducible code does not seem appropriate in this case.
But accurate 'at a minimum' information (and no HTML) does. There is
no such version as '2.14.0 beta', and will not be for a couple of
months. If you are running a beta version of R it is old, so please
update to a released or patched version. (Also, any version
calling itself '2.14.0 Under development' is old and needs updating:
the current R-devel displays no version number.)
[[alternative HTML version deleted]]
______________________________________________
R-help@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.
--
Brian D. Ripley, rip...@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
[[alternative HTML version deleted]]
______________________________________________
R-help@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.
______________________________________________
R-help@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.