gwidgets gtable 刷新
我遇到以下问题:
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)
我想刷新 t1 的内容:
dd <- c(7,8,9)
dd <- as.data.frame(dd)
但是当我运行时
t1[] <- dd
,我收到: Can't replacement with less columns
Apostolos
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
为了扩展约翰的答案,这里有一个例子。
请注意,问题中的示例代码在
gWidgetstcltk
下工作正常;这纯粹是GTK问题。To expand upon John's answer, here's an example.
Note that the sample code in the question works fine under
gWidgetstcltk
; it's a purely GTK issue.gtk 小部件使您可以在构造时选择列的类型,因此 gtable 不允许您减少列或更改列类型。如果您确实想这样做,请将小部件放入 ggroup 容器中,然后删除并添加新的小部件。
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 it is only about refreshing instead of completely changing its content I made very nice experience with something like this:
a complete 'refresh' might look like this: