obj_browse {svMisc}R Documentation

Functions to implement an object browser

Description

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

Usage

obj_browse(
  id = "default",
  envir = .GlobalEnv,
  all.names = NULL,
  pattern = NULL,
  group = NULL,
  sep = "\t",
  path = NULL,
  regenerate = FALSE
)

obj_clear(id = "default")

obj_dir()

obj_info(id = "default", envir = .GlobalEnv, object = "", path = NULL)

obj_list(
  id = "default",
  envir = .GlobalEnv,
  object = NULL,
  all.names = FALSE,
  pattern = "",
  group = "",
  all.info = FALSE,
  sep = "\t",
  path = NULL,
  compare = TRUE,
  ...
)

write.objList(x, path, sep = "\t", ...)

## S3 method for class 'objList'
print(
  x,
  sep = NA,
  eol = "\n",
  header = !attr(x, "all.info"),
  raw.output = !is.na(sep),
  ...
)

obj_search(sep = "\t", path = NULL, compare = TRUE)

obj_menu(
  id = "default",
  envir = .GlobalEnv,
  objects = "",
  sep = "\t",
  path = NULL
)

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,
  ...
)

objSearch(sep = "\t", path = NULL, compare = TRUE)

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

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.

sep

Separator to use between items (if path is not NULL).

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.

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.

...

Further arguments, passed to write.table().

x

Object returned by obj_list().

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 == TRUE.

raw.output

If TRUE, a compact, better suited for parsing output is produced.

objects

A list with selected items in the object browser.

Details

obj_browse() does the horse work. obj_dir() gets the temporary directory where exchange files with the GUI client 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.

obj_list() lists objects in a given environment, elements of a recursive object or function argument.

obj_search() lists the search path.

obj_clear() clears any reference to a given object browser.

obj_info() computes a tooltip info for a given object.

obj_menu()' 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 phgrosjean@sciviews.org & Kamil Barton kamil.barton@uni-wuerzburg.de

See Also

completion(), call_tip()

Examples

# Create various context menus
data(iris)
(obj_info(object = "iris"))
data(trees)
# For one object
(obj_menu(objects = "iris"))
# For multiple objects
(obj_menu(objects = c("iris", "trees")))
# For inexistant object (return "")
(obj_info(object = "noobject"))
(obj_menu(objects = "noobject"))
rm(iris, trees)

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

[Package svMisc version 1.2.3 Index]