-----Original Message-----
From: Charilaos Skiadas [mailto:cskiadas at gmail.com]
Sent: Friday, November 02, 2007 12:31 AM
To: John Fox
Cc: 'R-help help'
Subject: Re: [R] Rcmdr Plugin and menus.txt
Thanks John, no hurry.
I tried to debug it a little bit, without much success. Two things I
discovered:
1) The exact same lines work just fine if I place them in the
Rcmdr- menus.txt file in the Rcmdr package (and add the
"testOne" function
also.)
2) While trying to do debug(Commander), the thing I noticed
is that, when reading items from the menus.txt file, the
function seems to process them in the opposite order. So it
starts from the last item and moves up (well, I don't know if
it would move up since it crashes in the absence of the
psychMenu object). It seems the problem might be with the line:
Menus <- addMenus(Menus)
When examining Menus, I noticed that my new commands were
added at the beginning of the Menus data frame, and in a
messed up order:
Browse[1]> Menus[1:20,1:3]
type menuOrItem operationOrParent
8 item psychMenu cascade
1 menu psychMenu topMenu
4 menu testTwoMenu psychMenu
5 item testTwoMenu command
6 item testTwoMenu command
7 item testTwoMenu command
2 item psychMenu command
2100 menu fileMenu topMenu
3 item fileMenu command
410 item fileMenu command
510 item fileMenu command
610 item fileMenu command
710 item fileMenu command
810 item fileMenu command
9 item fileMenu command
10 menu exitMenu fileMenu
11 item exitMenu command
12 item exitMenu command
13 item fileMenu cascade
14 item topMenu cascade
I would hazard to guess that the problem is with the call
"Menus <- insertRows(Menus, line, where)" in line 866 of
Rcmdr. But at that point things got a bit too "technical" for
me. Hope this helps narrow the problem down a bit.
Thanks for the preprint. It is nicely written, though it
didn't shed any light on this problem.
Haris Skiadas
Department of Mathematics and Computer Science Hanover College
On Nov 1, 2007, at 3:32 PM, John Fox wrote:
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
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
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 TeachingDemos plugin. I am struggling trying to even
editing the menus.txt file. I would welcome any help from
has messed with it.
Essentially the problem I am having is: I cannot create a
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,
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
error:
Warning in max(which((Menus[, "operationOrParent"] ==
"cascade") & (Menus[, :
no non-missing arguments to max; returning -Inf Error
envir, enclos) : object "psychMenu" not found
I should point out further, that keeping only the first
from my original code also works fine, and creates the new
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
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