Hi everyone,

I made some tests with Rcmdr, to add a function with default parameters :

For example (very simple):

myfunction<-function(var="314"){
print("hello")
print(var)
}

if I run myfunction() directly i see :

> myfunction()
[1] "hello"
[1] "314"

it's ok.

But if i edit de Rcmdr-menu.txt (in
C:\Users\myname\Documents\R\win-library\2.15\Rcmdr\etc)
and add :

menu    MyMenu        topMenu
""                                            ""
""          ""
item    topMenu              cascade
"MyTest"                                MyMenu             ""          ""
item    MyMenu       command         "Test"
myfunction                   ""          ""

and I put myfonction into a file Rcmdr-test.R in the same folder

I have a new button with a cascade menu, and myfunction is corectly
sourced.. but :


that's what append :

> library(Rcmdr)
Loading required package: tcltk
Loading Tcl/Tk interface ... done
Loading required package: car
Loading required package: MASS
Loading required package: nnet
Sourced: Rcmdr-test.r


Rcmdr Version 1.9-2

If i use the Menu :

[1] "hello"
[1] "%var"

->there are %var instead off 314.
> myfunction
function(var="314"){
print("hello")
print(var)
}

I think that I made a mistake but I dont know were. How can I use Rcmdr
menu AND a default parameter ?

Can you help me?

Thx a lot.

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to