RGhelp <- function (lib.loc = NULL, verbose = getOption("verbose"),
try.all.packages = getOption("help.try.all.packages"))
############################################################
# A temporary trick to browse the ReGenesees 000Index html #
# page, without loosing links: works by actually kidding #
# the utils package. #
# NOTE: May reveal UNSTABLE if changes arise in utils!!!! #
############################################################
{
# Pick a convenience topic surely belonging to ReGenesees help pages...
topic <- "e.svydesign"
# Specify the package to be sift...
package <- "ReGenesees"
# Choose html help: pdf and other cannot work by kidding utils...
help_type = "html"
# Then start kidding utils package...
if (!missing(package))
if (is.name(y <- substitute(package)))
package <- as.character(y)
if (missing(topic)) {
if (!missing(package))
return(library(help = package, lib.loc = lib.loc,
character.only = TRUE))
if (!missing(lib.loc))
return(library(lib.loc = lib.loc))
topic <- "help"
package <- "utils"
lib.loc <- .Library
}
ischar <- tryCatch(is.character(topic) && length(topic) ==
1L, error = identity)
if (inherits(ischar, "error"))
ischar <- FALSE
if (!ischar) {
reserved <- c("TRUE", "FALSE", "NULL", "Inf", "NaN",
"NA", "NA_integer_", "NA_real_", "NA_complex_", "NA_character_")
stopic <- deparse(substitute(topic))
if (!is.name(substitute(topic)) && !stopic %in% reserved)
stop("'topic' should be a name, length-one character vector or reserved word")
topic <- stopic
}
help_type <- if (!length(help_type))
"text"
else match.arg(tolower(help_type), c("text", "html", "postscript",
"ps", "pdf"))
# Here access index.search from utils (find.package is a new entry in package base...):
paths <- utils_index.search(topic, find.package(package, lib.loc,
verbose = verbose))
tried_all_packages <- FALSE
if (!length(paths) && is.logical(try.all.packages) && !is.na(try.all.packages) &&
try.all.packages && missing(package) && missing(lib.loc)) {
for (lib in .libPaths()) {
packages <- .packages(TRUE, lib)
packages <- packages[is.na(match(packages, .packages()))]
paths <- c(paths, utils_index.search(topic, file.path(lib,
packages)))
}
paths <- paths[paths != ""]
tried_all_packages <- TRUE
}
paths <- unique(paths)
attributes(paths) <- list(call = match.call(), topic = topic,
tried_all_packages = tried_all_packages, type = help_type)
# Kidding utils, acts here:
paths[1] <- gsub("e.svydesign","00Index",paths[1])
class(paths) <- "help_files_with_topic"
# Note: MUST explicitly print, otherwise the html server doesn't start
# when RGhelp is triggered by a GUI dialog...
# paths
print(paths)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.