Display or execute a snippet of R code

Description

This command will display and/or execute small snippets of R code from the book Foundations and Applications of Statistics: An Introduction Using R.

Usage

1
2
3
4
	snippet(name, execute = TRUE, view = !execute, echo = TRUE, 
	ask = getOption("demo.ask"),
	verbose = getOption("verbose"),
	lib.loc = NULL, character.only = FALSE) 

Arguments

name

name of snippet

lib.loc

character vector of directory names of R libraries, or NULL. The default value of NULL corresponds to all libraries currently known.

character.only

logical. If TRUE, use nameas character string.

verbose

a logical. If TRUE, additional diagnostics are printed.

echo

a logical. If TRUE, show the R input when executing.

view

a logical. If TRUE, snippet code is displayed 'as is'.

execute

a logical. If TRUE, snippet code is executed. (The code and the results of the execution will be visible if echo is TRUE.)

ask

a logical (or "default") indicating if devAskNewPage(ask=TRUE) should be called before graphical output happens from the snippet code. The value "default" (the factory-fresh default) means to ask if echo == TRUE and the graphics device appears to be interactive. This parameter applies both to any currently opened device and to any devices opened by the demo code. If this is evaluated to TRUE and the session is interactive, the user is asked to press RETURN to start.

Details

snippet works much like demo, but the interface is simplified.

Author(s)

Randall Pruim

See Also

demo, source.

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.