Learn R Programming

svMisc (version 0.9-46)

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, path = NULL, compare = TRUE,
	...)

objMenu(id = "default", envir = .GlobalEnv, objects = "", sep = "\t",
	path = NULL)
objSearch(sep = "\t", path = NULL, compare = TRUE)

## S3 method for class 'objList':
print(x, sep = "\t", eol = "\n", header = !attr(x, "all.info"), ...)

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. Use path = 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 compare == 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.
...
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. 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

Complete, 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 = "TempEnv"))
(objMenu(envir = "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