According to documentation, tkrplot's fun parameter accepts a function
of no arguments. If you remove the arguments from your function, does
that kill the error message?
On Fri, Jun 3, 2011 at 11:42 AM, Costas Vorlow <costas.vorlow at gmail.com> wrote:
Hello,
I am trying to write a tcltk based program that plots/manipulates
xts/xoo time series objects.
I have the code I used from
## http://bioinf.wehi.edu.au/~wettenhall/RTclTkExamples/tkrplot.html :
##
require(quantmod)
require(tcltk)
library(tkrplot)
Sys.setenv(TZ="GMT")
getSymbols("^GSPC", from = "1960-01-01")
Myhscale <- 2.5 ? ?# Horizontal scaling
Myvscale <- 1.25 ? ?# Vertical scaling
plotFunction <- function(x)
{
? ?params <- par(bg="white")
? ? ?plot(x,main="A time series")
? ?par(params)
}
tt <- tktoplevel()
tkwm.title(tt,"Time Series")
img <- tkrplot(tt,fun=plotFunction((Cl(GSPC))),hscale=Myhscale,vscale=Myvscale)
tkgrid(img)
##
Although the output looks fine, I get the following message:
<Tcl>
img <- tkrplot(tt,fun=plotFunction((Cl(GSPC))),hscale=Myhscale,vscale=Myvscale)
Error in try(fun()) : could not find function "fun"
<Tcl>
Is this a serious problem with the code?
Thanks in advance,
Costas