[R] tkrplot Newbie

Costas Vorlow costas.vorlow at gmail.com
Fri Jun 3 17:42:23 CEST 2011


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"
> tkgrid(img)
<Tcl>

Is this a serious problem with the code?

Thanks in advance,
Costas



More information about the R-help mailing list