[R] Rcmdr Plugin and menus.txt
Charilaos Skiadas
cskiadas at gmail.com
Thu Nov 1 19:53:20 CET 2007
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
More information about the R-help
mailing list