objBrowse: Functions to implement an object browser

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/objBrowse.R

Description

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

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
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)

## S3 method for class 'objList'
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.

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.

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.

Author(s)

Philippe Grosjean ([email protected]) and Kamil Barton ([email protected])

See Also

completion, callTip

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## 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"))

svMisc documentation built on May 29, 2017, 12:18 p.m.