[R] Rcmdr Plugin and menus.txt

John Fox jfox at mcmaster.ca
Thu Nov 1 20:32:53 CET 2007


Dear Haris,

I'll take a look at this as soon as I have a chance, probably not until
tomorrow. In the meantime I've attached a "preprint" of an article that
describes how to write plug-ins. Perhaps you'll find that helpful. (I don't
know whether it will go through r-help, but you should receive the direct
email.)

Regards,
 John

--------------------------------
John Fox, Professor
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4
905-525-9140x23604
http://socserv.mcmaster.ca/jfox
-------------------------------- 

> -----Original Message-----
> From: r-help-bounces at r-project.org
> [mailto:r-help-bounces at r-project.org] On Behalf Of Charilaos Skiadas
> Sent: Thursday, November 01, 2007 2:53 PM
> To: R-help help
> Subject: [R] Rcmdr Plugin and menus.txt
> 
> Hi all,
> 
> 	I'm trying to write a plugin for R Commander, following the model of

> the TeachingDemos plugin. I am struggling trying to even add items by 
> editing the menus.txt file. I would welcome any help from anyone who 
> has messed with it.
> Essentially the problem I am having is: I cannot create a submenu to a 
> newly created menu. Here is what the menus.txt file looks like:
> 
> #   type    menu/item      operation/parent   
> label                              command/menu                 
> activation    install?
> menu    psychMenu       topMenu          
> ""                                      ""                           
> ""                      ""
> item    psychMenu       command         "Test"               
> testOne         ""                      ""
> item    topMenu         cascade          
> "Psych"                                 psychMenu                    
> ""                      ""
> menu    testTwoMenu      psychMenu  
> ""                                    ""                           
> ""                  ""
> item    testTwoMenu      command         "Binomial  
> distributions"                testOne                    
> ""                      ""
> item    testTwoMenu      command         "Normal  
> distributions"                  testOne                    
> ""                      ""
> item    testTwoMenu      command         "t  
> distributions"                       testOne                         
> ""                      ""
> item    psychMenu   cascade     "Submenu"                
> testTwoMenu                  ""                      ""
> 
> 
> I would expect the above to create:
> 1) A top level menu called "psychMenu", with the title "Psych"
> 2) An item in this menu with title "Test"
> 3) A second item, called "Submenu", and internally called 
> "testTwoMenu", which is itself a submenu.
> 4) Three items in that submenu.
> 
> The difference between this and the example is basically, that in the 
> example, the testTwoMenu is created as a submenu of the 
> distributionsMenu. If I change those last five lines above to read:
> 
> menu    testTwoMenu      distributionsMenu  
> ""                                    ""                           
> ""                  ""
> item    testTwoMenu      command         "Binomial  
> distributions"                testOne                    
> ""                      ""
> item    testTwoMenu      command         "Normal  
> distributions"                  testOne                    
> ""                      ""
> item    testTwoMenu      command         "t  
> distributions"                       testOne                         
> ""                      ""
> item    distributionsMenu   cascade     "Submenu"                
> testTwoMenu                  ""                      ""
> 
> 
> Then everything works fine and the submenu is created inside the 
> distributions menu. On the other hand, my original code gives me the
> error:
> 
> Warning in max(which((Menus[, "operationOrParent"] ==
> "cascade") & (Menus[,  :
> 	 no non-missing arguments to max; returning -Inf Error in eval(expr,

> envir, enclos) : object "psychMenu" not found
> 
> 
> I should point out further, that keeping only the first three lines 
> from my original code also works fine, and creates the new menu and an 
> item in it. The problem seems to arise when I try to create a submenu 
> in a menu I have just created.
> 
> Any thoughts how to accomplish this, or rather what am I doing wrong?
> 
> Should this go to R-SIG-GUI instead? Or is there another list more 
> appropriate?
> 
> Thanks,
> Haris Skiadas
> Department of Mathematics and Computer Science Hanover College
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wrapper.pdf
Type: application/pdf
Size: 211442 bytes
Desc: not available
Url : https://stat.ethz.ch/pipermail/r-help/attachments/20071101/3603125e/attachment.pdf 


More information about the R-help mailing list