devdocs/public/icons/docs/r
Cimbali 0b38f339f1 Add R documentation
Contains the R base + recommended package help pages converted to HTML.

Equivalent to the fullrefman.pdf generated from source, which is also
called « The R Reference Index » on https://cran.r-project.org/manuals.html

Currently does not include reference manuals and miscellanea (FAQ, etc.)

Script building the documentation:

```bash

set -e
set -o pipefail

DEVDOCSROOT=/path/to/devdocs/docs/r

RSOURCEDIR=${TMPDIR:-/tmp}/R/latest
RBUILDDIR=${TMPDIR:-/tmp}/R/build

RLATEST=https://cran.r-project.org/src/base/R-latest.tar.gz

R="$RBUILDDIR/bin/R"
libdir="$RBUILDDIR/library"
docdir=$RBUILDDIR/doc
makevars="$RSOURCEDIR/share/make/vars.mk"

if [ ! -f "$R" ] ; then
	if [ ! -d "$RSOURCEDIR" ]; then
		mkdir -p "$RSOURCEDIR" && curl "$RLATEST" | tar -C "$RSOURCEDIR" -xzf - --strip-components=1
	fi

	[ -d "$RBUILDDIR" ] || mkdir -p "$RBUILDDIR"
	[ -f "$RBUILDDIR/config.status" ] || (cd "$RBUILDDIR" && "$RSOURCEDIR/configure")
	make -C "$RBUILDDIR" && make -C "$RBUILDDIR" docs
fi

mkdir -p "$DEVDOCSROOT/doc" && cp -r "$docdir"/* "$DEVDOCSROOT/doc/"
find "$libdir" -type d -name 'html' -printf '%P\n' | while read d; do
	mkdir -p "$DEVDOCSROOT/library/$d"
	cp -r "$libdir/$d"/* "$DEVDOCSROOT/library/$d/"
done

R_PKGS_BASE="`sed -n 's/^R_PKGS_BASE *= *//p' $makevars`"
R_PKGS_RECOMMENDED="`sed -n 's/^R_PKGS_RECOMMENDED *= *//p' $makevars`"

cat <<EOF | _R_HELP_LINKS_TO_TOPICS_=FALSE $R --vanilla --no-echo
links <- tools::findHTMLlinks()
for (pkg in c(`echo $R_PKGS_BASE $R_PKGS_RECOMMENDED | sed 's/\S\+/"&"/g;s/ /, /g'`)) {
	Rd <- tools::Rd_db(pkg, lib.loc="$libdir")
	if (!length(Rd)) {
		message(paste("ERROR: no help files found for package", pkg))
	} else {
		message(paste0(pkg, "..."))
	}
	for(f in names(Rd)) {
		out <- file.path("$DEVDOCSROOT/library", pkg, "html", sub("[Rr]d$", "html", basename(f)))
		tools::Rd2HTML(Rd[[f]], out, package = "$pkg", defines = .Platform\$OS.type,
					   outputEncoding = "UTF-8", no_links = FALSE, dynamic = FALSE,
					   Links = links, stages = c("build", "install", "render"))
	}
}
EOF

echo "DONE! Start at $DEVDOCSROOT/doc/html/index.html (or $DEVDOCSROOT/doc/html/packages.html)"
```
2021-05-25 19:02:06 +02:00
..
16.png Add R documentation 2021-05-25 19:02:06 +02:00
16@2x.png Add R documentation 2021-05-25 19:02:06 +02:00
SOURCE Add R documentation 2021-05-25 19:02:06 +02:00