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 :
[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 :
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.
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?