Learn R Programming

Deducer (version 0.7-9)

deducer.addMenu: Controls Deducer's command line menus

Description

Controls Deducer's command line menus

Usage

deducer.addMenu(name, pos=length(menus)+1) deducer.setMenus(newMenus) deducer.getMenus() deducer.addMenuItem(name, pos=NULL, command, menuName, silent=TRUE) menuFunctions()

Arguments

name
name of item or menu to add
pos
position at which to add the item or menu
menuName
the name of the menu to add the item to
command
A character vector representing the R command to be run
silent
Should the command be executed silently
newMenus
new menus

Examples

Run this code

#add a menu with two items
deducer.addMenu("TestMenu")
deducer.addMenuItem("test1",,"cat('test1 selected')","TestMenu")
deducer.addMenuItem("test2",,"print(summary(lm(rnorm(100)~rnorm(100))))","TestMenu")

#Add menu to gui if applicable
if(.windowsGUI){
	winMenuAdd("TestMenu")
	winMenuAddItem("TestMenu", "test1", "cat('test1 selected')")
	winMenuAddItem("TestMenu", "test2", "print(summary(lm(rnorm(100)~rnorm(100))))")
}else if(.jgr){
	jgr.addMenu("TestMenu")
	jgr.addMenuItem("TestMenu", "test1", "cat('test1 selected')")
	jgr.addMenuItem("TestMenu", "test2", "print(summary(lm(rnorm(100)~rnorm(100))))")	
}


Run the code above in your browser using DataLab