R version 3.1.1 RC (2014-07-04 r66081) -- "Sock it to Me" Copyright (C) 2014 The R Foundation for Statistical Computing Platform: x86_64-unknown-linux-gnu (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > pkgname <- "tools" > source(file.path(R.home("share"), "R", "examples-header.R")) > options(warn = 1) > library('tools') > > base::assign(".oldSearch", base::search(), pos = 'CheckExEnv') > cleanEx() > nameEx("HTMLheader") > ### * HTMLheader > > flush(stderr()); flush(stdout()) > > ### Name: HTMLheader > ### Title: Generate a standard HTML header for R help > ### Aliases: HTMLheader > ### Keywords: utilities documentation > > ### ** Examples > > cat(HTMLheader("This is a sample header"), sep="\n") R: This is a sample header

This is a sample header


[Top]
> > > > cleanEx() > nameEx("Rd2HTML") > ### * Rd2HTML > > flush(stderr()); flush(stdout()) > > ### Name: Rd2HTML > ### Title: Rd Converters > ### Aliases: Rd2txt Rd2HTML Rd2ex Rd2latex > ### Keywords: documentation > > ### ** Examples > cleanEx() > nameEx("Rd2txt_options") > ### * Rd2txt_options > > flush(stderr()); flush(stdout()) > > ### Name: Rd2txt_options > ### Title: Set formatting options for text help > ### Aliases: Rd2txt_options > ### Keywords: documentation > > ### ** Examples > > > > > cleanEx() > nameEx("Rdutils") > ### * Rdutils > > flush(stderr()); flush(stdout()) > > ### Name: Rdutils > ### Title: Rd Utilities > ### Aliases: Rd_db > ### Keywords: utilities documentation > > ### ** Examples > > > cleanEx() > nameEx("assertCondition") > ### * assertCondition > > flush(stderr()); flush(stdout()) > > ### Name: assertCondition > ### Title: Asserting Error Conditions > ### Aliases: assertCondition assertWarning assertError > ### Keywords: programming error > > ### ** Examples > > assertError(sqrt("abc")) > assertWarning(matrix(1:8, 4,3)) > > assertCondition( ""-1 ) # ok, any condition would satisfy this > > try( assertCondition(sqrt(2), "warning") ) Error in assertCondition(sqrt(2), "warning") : Failed to get warning in evaluating sqrt(2) > ## .. Failed to get warning in evaluating sqrt(2) > assertCondition(sqrt("abc"), "error") # ok > try( assertCondition(sqrt("abc"), "warning") )# -> error: had no warning Error in assertCondition(sqrt("abc"), "warning") : Got simpleError in evaluating sqrt("abc"); wanted warning > assertCondition(sqrt("abc"), "error") > ## identical to assertError() call above > > assertCondition(matrix(1:5, 2,3), "warning") > try( assertCondition(matrix(1:8, 4,3), "error") ) Error in assertCondition(matrix(1:8, 4, 3), "error") : Got simpleWarning in evaluating matrix(1:8, 4, 3); wanted error > ## .. Failed to get expected error .... > > ## either warning or worse: > assertCondition(matrix(1:8, 4,3), "error","warning") # OK > assertCondition(matrix(1:8, 4, 3), "warning") # OK > > ## when both are signalled: > ff <- function() { warning("my warning"); stop("my error") } > assertCondition(ff(), "warning") > ## but assertWarning does not allow an error to follow > try(assertWarning(ff())) Error in assertWarning(ff()) : Got warning in evaluating ff(), but also an error > assertCondition(ff(), "error") # ok > assertCondition(ff(), "error", "warning") # ok (quietly, catching warning) > > ## assert that assertC..() does not assert [and use *one* argument only] > assertCondition( assertCondition(sqrt( 2 ), "warning") ) > assertCondition( assertCondition(sqrt("abc"), "warning"), "error") > assertCondition( assertCondition(matrix(1:8, 4,3), "error"), + "error") > > > > cleanEx() > nameEx("bibstyle") > ### * bibstyle > > flush(stderr()); flush(stdout()) > > ### Name: bibstyle > ### Title: Select or define a bibliography style. > ### Aliases: bibstyle getBibstyle > ### Keywords: utilties documentation > > ### ** Examples > > ## Don't show: > options(useFancyQuotes = FALSE) > ## End Don't show > refs <- + c(bibentry(bibtype = "manual", + title = "R: A Language and Environment for Statistical Computing", + author = person("R Core Team"), + organization = "R Foundation for Statistical Computing", + address = "Vienna, Austria", + year = 2013, + url = "http://www.R-project.org"), + bibentry(bibtype = "article", + author = c(person(c("George", "E.", "P."), "Box"), + person(c("David", "R."), "Cox")), + year = 1964, + title = "An Analysis of Transformations", + journal = "Journal of the Royal Statistical Society, Series B", + volume = 26, + pages = "211-252")) > > bibstyle("unsorted", sortKeys = function(refs) seq_along(refs), + fmtPrefix = function(paper) paste0("[", paper$.index, "]"), + .init = TRUE) > print(refs, .bibstyle = "unsorted") [1] R Core Team (2013). _R: A Language and Environment for Statistical Computing_. R Foundation for Statistical Computing, Vienna, Austria. . [2] Box GEP and Cox DR (1964). "An Analysis of Transformations." _Journal of the Royal Statistical Society, Series B_, *26*, pp. 211-252. > > > > cleanEx() > nameEx("buildVignettes") > ### * buildVignettes > > flush(stderr()); flush(stdout()) > > ### Name: buildVignettes > ### Title: List and Build Package Vignettes > ### Aliases: buildVignettes pkgVignettes > ### Keywords: utilities documentation > > ### ** Examples > > gVigns <- pkgVignettes("grid") > > > > cleanEx() > nameEx("charsets") > ### * charsets > > flush(stderr()); flush(stdout()) > > ### Name: charsets > ### Title: Conversion Tables between Character Sets > ### Aliases: Adobe_glyphs charset_to_Unicode > ### Keywords: datasets > > ### ** Examples > > ## find Adobe names for ISOLatin2 chars. > latin2 <- charset_to_Unicode[, "ISOLatin2"] > aUnicode <- as.numeric(paste0("0x", Adobe_glyphs$unicode)) > keep <- aUnicode %in% latin2 > aUnicode <- aUnicode[keep] > aAdobe <- Adobe_glyphs[keep, 1] > ## first match > aLatin2 <- aAdobe[match(latin2, aUnicode)] > ## all matches > bLatin2 <- lapply(1:256, function(x) aAdobe[aUnicode == latin2[x]]) > format(bLatin2, justify = "none") [1] "" "controlSTX" [3] "controlSOT" "controlETX" [5] "controlEOT" "controlENQ" [7] "controlACK" "controlBEL" [9] "controlBS" "controlHT" [11] "controlLF" "controlVT" [13] "controlFF" "controlCR" [15] "controlSO" "controlSI" [17] "controlDLE" "controlDC1" [19] "controlDC2" "controlDC3" [21] "controlDC4" "controlNAK" [23] "controlSYN" "controlETB" [25] "controlCAN" "controlEM" [27] "controlSUB" "controlESC" [29] "controlFS" "controlGS" [31] "controlRS" "controlUS" [33] "space, spacehackarabic" "exclam" [35] "quotedbl" "numbersign" [37] "dollar" "percent" [39] "ampersand" "quotesingle" [41] "parenleft" "parenright" [43] "asterisk" "plus" [45] "comma" "hyphen" [47] "period" "slash" [49] "zero" "one" [51] "two" "three" [53] "four" "five" [55] "six" "seven" [57] "eight" "nine" [59] "colon" "semicolon" [61] "less" "equal" [63] "greater" "question" [65] "at" "A" [67] "B" "C" [69] "D" "E" [71] "F" "G" [73] "H" "I" [75] "J" "K" [77] "L" "M" [79] "N" "O" [81] "P" "Q" [83] "R" "S" [85] "T" "U" [87] "V" "W" [89] "X" "Y" [91] "Z" "bracketleft" [93] "backslash" "bracketright" [95] "asciicircum" "underscore" [97] "grave" "a" [99] "b" "c" [101] "d" "e" [103] "f" "g" [105] "h" "i" [107] "j" "k" [109] "l" "m" [111] "n" "o" [113] "p" "q" [115] "r" "s" [117] "t" "u" [119] "v" "w" [121] "x" "y" [123] "z" "braceleft" [125] "bar, verticalbar" "braceright" [127] "asciitilde" "controlDEL" [129] "" "" [131] "" "" [133] "" "" [135] "" "" [137] "" "" [139] "" "" [141] "" "" [143] "" "" [145] "" "" [147] "" "" [149] "" "" [151] "" "" [153] "" "" [155] "" "" [157] "" "" [159] "" "" [161] "nbspace, nonbreakingspace" "Aogonek" [163] "breve" "Lslash" [165] "currency" "Lcaron" [167] "Sacute" "section" [169] "dieresis" "Scaron" [171] "Scedilla" "Tcaron" [173] "Zacute" "sfthyphen, softhyphen" [175] "Zcaron" "Zdot, Zdotaccent" [177] "degree" "aogonek" [179] "ogonek" "lslash" [181] "acute" "lcaron" [183] "sacute" "caron" [185] "cedilla" "scaron" [187] "scedilla" "tcaron" [189] "zacute" "hungarumlaut" [191] "zcaron" "zdot, zdotaccent" [193] "Racute" "Aacute" [195] "Acircumflex" "Abreve" [197] "Adieresis" "Lacute" [199] "Cacute" "Ccedilla" [201] "Ccaron" "Eacute" [203] "Eogonek" "Edieresis" [205] "Ecaron" "Iacute" [207] "Icircumflex" "Dcaron" [209] "Dcroat, Dslash" "Nacute" [211] "Ncaron" "Oacute" [213] "Ocircumflex" "Odblacute, Ohungarumlaut" [215] "Odieresis" "multiply" [217] "Rcaron" "Uring" [219] "Uacute" "Udblacute, Uhungarumlaut" [221] "Udieresis" "Yacute" [223] "Tcedilla, Tcommaaccent" "germandbls" [225] "racute" "aacute" [227] "acircumflex" "abreve" [229] "adieresis" "lacute" [231] "cacute" "ccedilla" [233] "ccaron" "eacute" [235] "eogonek" "edieresis" [237] "ecaron" "iacute" [239] "icircumflex" "dcaron" [241] "dcroat, dmacron" "nacute" [243] "ncaron" "oacute" [245] "ocircumflex" "odblacute, ohungarumlaut" [247] "odieresis" "divide" [249] "rcaron" "uring" [251] "uacute" "udblacute, uhungarumlaut" [253] "udieresis" "yacute" [255] "tcedilla, tcommaaccent" "dotaccent" > > > > cleanEx() > nameEx("checkFF") > ### * checkFF > > flush(stderr()); flush(stdout()) > > ### Name: checkFF > ### Title: Check Foreign Function Calls > ### Aliases: checkFF print.checkFF > ### Keywords: programming utilities > > ### ** Examples > > > cleanEx() > nameEx("checkPoFiles") > ### * checkPoFiles > > flush(stderr()); flush(stdout()) > > ### Name: checkPoFiles > ### Title: Check translation files for inconsistent format strings. > ### Aliases: checkPoFile checkPoFiles > ### Keywords: utilities > > ### ** Examples > > ## Not run: > ##D checkPoFiles("de", "/path/to/R/src/directory") > ## End(Not run) > > > > cleanEx() > nameEx("checkRdaFiles") > ### * checkRdaFiles > > flush(stderr()); flush(stdout()) > > ### Name: checkRdaFiles > ### Title: Report on Details of Saved Images or Re-saves them > ### Aliases: checkRdaFiles resaveRdaFiles > ### Keywords: utilities > > ### ** Examples > ## Not run: > ##D ## from a package top-level source directory > ##D paths <- sort(Sys.glob(c("data/*.rda", "data/*.RData"))) > ##D (res <- checkRdaFiles(paths)) > ##D ## pick out some that may need attention > ##D bad <- is.na(res$ASCII) | res$ASCII | (res$size > 1e4 & res$compress == "none") > ##D res[bad, ] > ## End(Not run) > > > cleanEx() > nameEx("delimMatch") > ### * delimMatch > > flush(stderr()); flush(stdout()) > > ### Name: delimMatch > ### Title: Delimited Pattern Matching > ### Aliases: delimMatch > ### Keywords: character > > ### ** Examples > > x <- c("\\value{foo}", "function(bar)") > delimMatch(x) [1] 7 -1 attr(,"match.length") [1] 5 -1 > delimMatch(x, c("(", ")")) [1] -1 9 attr(,"match.length") [1] -1 5 > > > > cleanEx() > nameEx("dependsOnPkgs") > ### * dependsOnPkgs > > flush(stderr()); flush(stdout()) > > ### Name: dependsOnPkgs > ### Title: Find Reverse Dependencies > ### Aliases: dependsOnPkgs > ### Keywords: utilities > > ### ** Examples > > ## there are few dependencies in a vanilla R installation: > ## lattice may not be installed > dependsOnPkgs("lattice") [1] "Matrix" "nlme" "mgcv" > > > > cleanEx() > nameEx("encoded") > ### * encoded > > flush(stderr()); flush(stdout()) > > ### Name: encoded_text_to_latex > ### Title: Translate non-ASCII Text to LaTeX Escapes > ### Aliases: encoded_text_to_latex > ### Keywords: utilities > > ### ** Examples > > x <- "fa\xE7ile" > encoded_text_to_latex(x, "latin1") [1] "fa{\\c c}ile" > ## Not run: > ##D ## create a tex file to show the upper half of 8-bit charsets > ##D x <- rawToChar(as.raw(160:255), multiple = TRUE) > ##D (x <- matrix(x, ncol = 16, byrow = TRUE)) > ##D xx <- x > ##D xx[] <- encoded_text_to_latex(x, "latin1") # or latin2 or latin9 > ##D xx <- apply(xx, 1, paste, collapse = "&") > ##D con <- file("test-encoding.tex", "w") > ##D header <- c( > ##D "\\documentclass{article}", > ##D "\\usepackage[T1]{fontenc}", > ##D "\\usepackage{Rd}", > ##D "\\begin{document}", > ##D "\\HeaderA{test}{}{test}", > ##D "\\begin{Details}\relax", > ##D "\\Tabular{cccccccccccccccc}{") > ##D trailer <- c("}", "\\end{Details}", "\\end{document}") > ##D writeLines(header, con) > ##D writeLines(paste0(xx, "\\"), con) > ##D writeLines(trailer, con) > ##D close(con) > ##D ## and some UTF_8 chars > ##D x <- intToUtf8(as.integer( > ##D c(160:383,0x0192,0x02C6,0x02C7,0x02CA,0x02D8, > ##D 0x02D9, 0x02DD, 0x200C, 0x2018, 0x2019, 0x201C, > ##D 0x201D, 0x2020, 0x2022, 0x2026, 0x20AC)), > ##D multiple = TRUE) > ##D x <- matrix(x, ncol = 16, byrow = TRUE) > ##D xx <- x > ##D xx[] <- encoded_text_to_latex(x, "UTF-8") > ##D xx <- apply(xx, 1, paste, collapse = "&") > ##D con <- file("test-utf8.tex", "w") > ##D writeLines(header, con) > ##D writeLines(paste(xx, "\\", sep = ""), con) > ##D writeLines(trailer, con) > ##D close(con) > ## End(Not run) > > > cleanEx() > nameEx("fileutils") > ### * fileutils > > flush(stderr()); flush(stdout()) > > ### Name: fileutils > ### Title: File Utilities > ### Aliases: file_ext file_path_as_absolute file_path_sans_ext > ### list_files_with_exts list_files_with_type > ### Keywords: file > > ### ** Examples > > > cleanEx() > nameEx("find_gs_cmd") > ### * find_gs_cmd > > flush(stderr()); flush(stdout()) > > ### Name: find_gs_cmd > ### Title: Find a GhostScript Executable > ### Aliases: find_gs_cmd > > ### ** Examples > ## Not run: > ##D ## Suppose a Solaris system has GhostScript 9.00 on the path and > ##D ## 9.07 in /opt/csw/bin. Then one might set > ##D Sys.setenv(R_GSCMD = "/opt/csw/bin/gs") > ## End(Not run) > > > cleanEx() > nameEx("getDepList") > ### * getDepList > > flush(stderr()); flush(stdout()) > > ### Name: getDepList > ### Title: Functions to Retrieve Dependency Information > ### Aliases: getDepList pkgDepends > ### Keywords: utilities > > ### ** Examples > > pkgDepends("tools", local = FALSE) $Depends character(0) $Installed character(0) $Found list() $NotFound character(0) $R character(0) attr(,"class") [1] "DependsList" "list" > > > > cleanEx() > nameEx("getVignetteInfo") > ### * getVignetteInfo > > flush(stderr()); flush(stdout()) > > ### Name: getVignetteInfo > ### Title: Get information on installed vignettes. > ### Aliases: getVignetteInfo > ### Keywords: utilities documentation > > ### ** Examples > > > > > cleanEx() > nameEx("installFoundDepends") > ### * installFoundDepends > > flush(stderr()); flush(stdout()) > > ### Name: installFoundDepends > ### Title: A function to install unresolved dependencies > ### Aliases: installFoundDepends > ### Keywords: utilities > > ### ** Examples > > ## Set up a temporary directory to install packages to > tmp <- tempfile() > dir.create(tmp) > > pDL <- pkgDepends("tools", local = FALSE) > installFoundDepends(pDL$Found, destdir = tmp) NULL > > > > cleanEx() > nameEx("md5sum") > ### * md5sum > > flush(stderr()); flush(stdout()) > > ### Name: md5sum > ### Title: Compute MD5 Checksums > ### Aliases: md5sum > ### Keywords: utilities > > ### ** Examples > > as.vector(md5sum(dir(R.home(), pattern = "^COPY", full.names = TRUE))) [1] "eb723b61539feef013de476e68b5c50a" > > > > cleanEx() > nameEx("package_dependencies") > ### * package_dependencies > > flush(stderr()); flush(stdout()) > > ### Name: package_dependencies > ### Title: Computations on the Dependency Hierarchy of Packages > ### Aliases: package_dependencies > ### Keywords: utilities > > ### ** Examples > > ## Not run: > ##D pdb <- available.packages() > ##D deps <- package_dependencies(packages = "MASS", pdb, > ##D which = c("Depends", "Imports", "LinkingTo", "Suggests"), > ##D recursive = TRUE, reverse = TRUE) > ##D length(deps$MASS) > ## End(Not run) > > > > cleanEx() > nameEx("parseLatex") > ### * parseLatex > > flush(stderr()); flush(stdout()) > > ### Name: parseLatex > ### Title: These experimental functions work with a subset of LaTeX code. > ### Aliases: parseLatex deparseLatex latexToUtf8 > ### Keywords: utilities documentation > > ### ** Examples > > > cleanEx() > nameEx("print.via.format") > ### * print.via.format > > flush(stderr()); flush(stdout()) > > ### Name: .print.via.format > ### Title: Printing Utilities > ### Aliases: .print.via.format > ### Keywords: utilities > > ### ** Examples > > ## The function is simply defined as > function (x, ...) { + writeLines(format(x, ...)) + invisible(x) + } function (x, ...) { writeLines(format(x, ...)) invisible(x) } > > ## is used for simple print methods in R, and as prototype for new methods. > > > > cleanEx() > nameEx("pskill") > ### * pskill > > flush(stderr()); flush(stdout()) > > ### Name: pskill > ### Title: Kill a Process > ### Aliases: pskill SIGHUP SIGINT SIGQUIT SIGKILL SIGTERM SIGSTOP SIGTSTP > ### SIGCONT SIGCHLD SIGUSR1 SIGUSR2 > ### Keywords: utilities > > ### ** Examples > ## Not run: > ##D pskill(c(237, 245), SIGKILL) > ## End(Not run) > > > cleanEx() > nameEx("showNonASCII") > ### * showNonASCII > > flush(stderr()); flush(stdout()) > > ### Name: showNonASCII > ### Title: Pick Out Non-ASCII Characters > ### Aliases: showNonASCII showNonASCIIfile > ### Keywords: utilities > > ### ** Examples > > out <- c( + "fa\xE7ile test of showNonASCII():", + "\\details{", + " This is a good line", + " This has an \xfcmlaut in it.", + " OK again.", + "}") > f <- tempfile() > cat(out, file = f, sep = "\n") > > showNonASCIIfile(f) 1: faile test of showNonASCII(): 4: This has an mlaut in it. > unlink(f) > > > > cleanEx() > nameEx("toHTML") > ### * toHTML > > flush(stderr()); flush(stdout()) > > ### Name: toHTML > ### Title: Display an object in HTML. > ### Aliases: toHTML toHTML.packageIQR toHTML.news_db > ### Keywords: utilities documentation > > ### ** Examples > > cat(toHTML(demo(package = "base")), sep = "\n") R: R

R


[Top]

Demos in package ‘base’

error.catching More examples on catching and handling errors
is.things Explore some properties of R objects and is.FOO() functions. Not for newbies!
recursion Using recursion for adaptive integration
scoping An illustration of lexical scoping.

> > > > cleanEx() > nameEx("undoc") > ### * undoc > > flush(stderr()); flush(stdout()) > > ### Name: undoc > ### Title: Find Undocumented Objects > ### Aliases: undoc print.undoc > ### Keywords: documentation > > ### ** Examples > > undoc("tools") # Undocumented objects in 'tools' > > > > cleanEx() > nameEx("vignetteDepends") > ### * vignetteDepends > > flush(stderr()); flush(stdout()) > > ### Name: vignetteDepends > ### Title: Retrieve Dependency Information for a Vignette > ### Aliases: vignetteDepends > ### Keywords: utilities > > ### ** Examples > > ## This may not be installed > gridEx <- system.file("doc", "grid.Rnw", package = "grid") > vignetteDepends(gridEx) $Depends [1] "lattice" $Installed [1] "lattice" $Found list() $NotFound character(0) $R [1] "R (>= 2.15.1)" attr(,"class") [1] "DependsList" "list" > > > > cleanEx() > nameEx("vignetteEngine") > ### * vignetteEngine > > flush(stderr()); flush(stdout()) > > ### Name: vignetteEngine > ### Title: Set or Get a Vignette Processing Engine > ### Aliases: vignetteEngine > ### Keywords: utilities documentation > > ### ** Examples > > str(vignetteEngine("Sweave")) List of 6 $ name : chr "Sweave" $ package: chr "utils" $ pattern: chr "[.][rRsS](nw|tex)$" $ weave :function (...) $ tangle :function (...) $ aspell :List of 2 ..$ filter : chr "Sweave" ..$ control: chr "-t" > > > > cleanEx() > nameEx("writePACKAGES") > ### * writePACKAGES > > flush(stderr()); flush(stdout()) > > ### Name: write_PACKAGES > ### Title: Generate PACKAGES files > ### Aliases: write_PACKAGES > ### Keywords: file utilities > > ### ** Examples > > ## Not run: > ##D write_PACKAGES("c:/myFolder/myRepository") # on Windows > ##D write_PACKAGES("/pub/RWin/bin/windows/contrib/2.9", > ##D type = "win.binary") # on Linux > ## End(Not run) > > > cleanEx() > nameEx("xgettext") > ### * xgettext > > flush(stderr()); flush(stdout()) > > ### Name: xgettext > ### Title: Extract Translatable Messages from R Files in a Package > ### Aliases: xgettext xngettext xgettext2pot > ### Keywords: utilities > > ### ** Examples > ## Not run: > ##D ## in a source-directory build of R: > ##D xgettext(file.path(R.home(), "src", "library", "splines")) > ## End(Not run) > > > ### *