#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