Apostolos Polymeros
Apostolos Polymeros

Reputation: 843

gWidgets: add/remove rows from gdf

How do we add/remove rows from gdf ? EXAMPLE

DataFrame <- data.frame(cbind(x=1, y=1:10))
obj <- gdf(DataFrame, container = TRUE)

How do we add/remove rows from obj ?

Upvotes: 1

Views: 421

Answers (1)

jverzani
jverzani

Reputation: 5700

Well, in design you can do assignment via [<-

obj[11,] <- list(x=1, y=11)
rownames(obj)[11] <- "new row name"

That works for gWidgetsRGtk2 (with some complaint about a color), but may not for other toolkits. (Not even gWidgets2RGtk2 on github, which is something to fix!)

As for removing rows, one could do:

obj[] <- obj[-5,]

Again working in gWidgetsRGtk2, but YMMV with the other toolkits.

Upvotes: 2

Related Questions