Learn R Programming

svMisc (version 0.9-70)

objBrowse: Functions to implement an object browser

Description

These functions provide features required to implement a complete object browser in a GUI client.

Usage

objBrowse(id = "default", envir = .GlobalEnv, all.names = NULL, pattern = NULL, group = NULL, sep = "\t", path = NULL, regenerate = FALSE) objClear(id = "default") objDir() objInfo(id = "default", envir = .GlobalEnv, object = "", path = NULL) objList(id = "default", envir = .GlobalEnv, object = NULL, all.names = FALSE, pattern = "", group = "", all.info = FALSE, sep = "\t", path = NULL, compare = TRUE, ...)
objMenu(id = "default", envir = .GlobalEnv, objects = "", sep = "\t", path = NULL) objSearch(sep = "\t", path = NULL, compare = TRUE)
"print"(x, sep = NA, eol = "\n", header = !attr(x, "all.info"), raw.output = !is.na(sep), ...)
write.objList(x, path, sep = "\t", ...)

Arguments

id
the id of the object browser (you can run several ones concurrently, providing you give them different ids).
envir
an environment, or the name of the environment, or the position in the search() path.
all.names
do we display all names (including hidden variables starting with '.')?
pattern
a pattern to match for selecting variables.
group
a group to filter.
path
the path where to write a temporary file with the requested information. Set to NULL (default) if you don't pass this data to your GUI client by mean of a file.
regenerate
do we force to regenerate the information?
object
name of the object selected in the object browser, components/arguments of which should be listed.
objects
a list with selected items in the object browser
all.info
do we return all the information (envir as first column or not (by default).
compare
if TRUE, result is compared with last cached value and the client is updated only if something changed.
sep
separator to use between items (if path is not NULL).
x
object returned by objList.
eol
separator to use between object entries, default is to list each item in a separate line.
header
if TRUE, two-line header is printed, of the form: Environment = environment name Object = object name Default is not to print header if all.info is true.
raw.output
if TRUE, a compact, better suited for parsing output is produced.
...
further arguments, passed to write.table.

Value

Depending on the function, a list, a string, a reference to an external, temporary file or TRUE in case of success or FALSE otherwise is returned invisibly.

Details

objBrowse() does the horsework. objDir() gets the temporary directory where exchange files are stored, in case you exchange data through files. You can use a better way to communicate with your GUI (you have to provide your code) and disable writing to files by using path = NULL. objList() lists objects in a given environment, elements of a recursive object or function argument. objSearch() lists the search path. objClear() clears any reference to a given object browser. objInfo() computes a tooltip info for a given object. objMenu() computes a context menu for selected object(s) in the object explorer managed by the GUI client. print.objList() print method for objList objects.

See Also

completion, callTip

Examples

Run this code
## Create various context menus
data(iris)
(objInfo(object = "iris"))
data(trees)
## For one object
(objMenu(objects = "iris"))
## For multiple objects
(objMenu(objects = c("iris", "trees")))
## For inxistant object (return "")
(objInfo(object = "noobject"))
(objMenu(objects = "noobject"))
rm(iris, trees)

## For environments
(objInfo(envir = ".GlobalEnv"))
(objMenu(envir = ".GlobalEnv"))
(objInfo(envir = "SciViews:TempEnv"))
(objMenu(envir = "SciViews:TempEnv"))
(objInfo(envir = "package:datasets"))
(objMenu(envir = "package:datasets"))
## For an environment that does not exist on the search path (return "")
(objInfo(envir = "noenvir"))
(objMenu(envir = "noenvir"))

Run the code above in your browser using DataLab