I\'m experimenting with gWidgetsWWW and encountered a strange error. I created a button with a handler to knit2html a report which used the data.table assignment operator \"
This seems to be an environment issue. That is probably a problem between data.table and gWidgetsWWW. On knitr's side, there is at least one solution, which is to specify the environment for knitr to be the global environment, e.g.
knit2html("test_report.Rmd", envir = globalenv())
Edit:
To illustrate this issue is irrelevant to knitr, try this:
library(gWidgetsWWW)
w<-gwindow("Test Window")
g<-ggroup(horizontal=F,cont=w)
b<-gbutton("Report Button",cont=g,handler=function(h,...){
library(data.table)
df<-data.frame(State=rownames(USArrests),USArrests)
print(data.table(df)[,State:=tolower(State)])
})
visible(w)<-TRUE
Save it as test_gui.R, and
library(gWidgetsWWW)
localServerOpen('test_gui.R')
Click the button and you will also see the error.