[Rd] How to link to vignette from .Rd file
Dominick Samperi
dsamperi at DecisionSynergy.com
Tue Nov 7 22:01:03 CET 2006
Dirk Eddelbuettel wrote:
> There is options("pdfviewer") -- at least under Unix. Maybe there is
> even an R call to use it on a file, employed by the help system?
> Dirk
Thanks,
Here is a more complete solution that can be turned into a general-purpose
function...
# Displays PDF file as an R demo
#
pkgName <- 'MyPackage'
pkgDir <- 'doc'
pdfFile <- 'MyPackageDoc.pdf'
isWindows <- (Sys.info()['sysname'] == 'Windows')
pkgLoc <- system.file(".", ".", package=pkgName)
pkgLoc <- substring(pkgLoc, 1, nchar(pkgLoc)-nchar(pkgName)-5)
file <- system.file(pkgDir, pdfFile, package=pkgName,lib.loc=pkgLoc)
if(isWindows) { # Windows automatically finds executable based on file type.
system(paste("CMD /C ", file, "\n"))
} else { # Change this to use path to Adobe reader if desired.
system(paste(options("pdfviewer"), file, "\n"))
}
More information about the R-devel
mailing list