Learn R Programming

JGR (version 1.9-2)

jgr.addMenuItem: New JGR Console MenuItem

Description

adds a new MenuItem to specified JGR Console Menu

Usage

jgr.addMenuItem(menu,name,command,silent=TRUE)
jgr.insertMenuItem(menu,name,command,index,silent=TRUE)

Value

MenuItem

Arguments

menu

Name of the menu that this item will be added to

name

Name of the menu item to add

command

R expression(s) as a string to be parsed and evaluated or a function that will be called (without arguments) when the menu item is selected

index

index at which to insert

silent

If FALSE, executes as if entered into the cons

See Also

jgr.addMenu jgr.addMenuSeparator

Examples

Run this code
jgr.addMenu("Workspace")
jgr.addMenuItem("Workspace","Browse","ls()",FALSE)
jgr.addMenuSeparator("Workspace")
jgr.addMenuItem("Workspace","List Functions",
  function() unlist(lapply(ls(envir=.GlobalEnv),
                           function(x) if (is.function(get(x))) x else NULL )))

Run the code above in your browser using DataLab