I encounter the following problem:
library(gWidgets)
options(guiToolkit = "RGtk2")
aa <- c(1,2,3)
bb <- c(4,5,6)
cc <- cbind(aa,bb)
cc <-as.data.frame(cc)
t1 <- gtable(cc, container=TRUE)
I want to refresh the content of t1 with:
dd <- c(7,8,9)
dd <- as.data.frame(dd)
But when I run
t1[] <- dd
I receive: Can't replace with fewer columns
Apostolos
To expand upon John's answer, here's an example.
#Data
cc <- data.frame(aa = 1:3, bb = 4:6)
dd <- data.frame(X = 7:9)
#Wigdets
win <- gwindow()
grp <- ggroup(container = win)
t1 <- gtable(cc, container = grp)
#Refresh widget
delete(grp, t1)
t1 <- gtable(dd, container = grp)
Note that the sample code in the question works fine under gWidgetstcltk
; it's a purely GTK issue.
The gtk widget makes you pick the type of column at construction, so gtable doesn't let you have fewer columns or change column types. If you really want to do this, put the widget in a ggroup container, then delete and add a new widget.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With