tkWidgets (version 1.50.0)

objectBrowser: View the Objects in the Workspace

Description

This widget allows uers to view and select objects from the workspace. When the End button is pressed, the selected objects will be returned as a list.

Usage

objectBrowser(env = .GlobalEnv,fun = noAuto, textToShow = "Select object(s)", nSelect = -1)

Arguments

fun
function to test whether certain conditions are met by the objects. Only objects that meet the conditions will be displayed.
textToShow
character with the message to be shown on the widget as an instruction.
nSelect
integer indicating the number of objects to select. No limitation if nSelect = -1 as per default.
env
env a default environment object to start object Browser

Value

A list of lists with a name and value pair for each object.

Details

This function will return a list of lists with a "name" and "obj" pair for each object selected. The "name" will be the name of the object and "obj" will be the value of the object. If the object is a package, a description of the contents of the package will be the value. If the selected object is a function, a text string of the original code will be the value. A function can be passed to impose a filtering mechanisms on the objects to be displayed. See function isCharacter for an example of writing a filtering function for objectBrowser.

The buttons and their expected behavior are

Up
Moves one level up along the search list and displays the content in the box for object names on the left of the widget.

Select \>\>
When objects in the box for object names have been highlighted by clicking or clicking/dragging, this button will display the highlighted object names in the box for selected objects on the right.

Reset
Moves back to .GlobalEnv which is the default starting point of the system.

\<\< remove<="" code="">
When object names in the box for selected objects have been highlighted by clicking or clicking/dragging and this button is pressed, the highlighted object names will be removed from the display.

Clear
Removes all the object names from the box for selected objects.

Cancel
Exits the widget and returns NULL when pressed.

End
Returns a list of lists with names of the objects in the box for selected objects and their corresponding values or NULL if nothing exists in the box.

Examples

Run this code
## The example here is only run interactively since it requires user
## interference which may cause problems if not available:
if(interactive()) {

# Call the function with the isCharacter function.
r <- objectBrowser()
str(r) # show what we've got
}

Run the code above in your browser using DataLab