1

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 ?

Richie Cotton
  • 118,240
  • 47
  • 247
  • 360
Apostolos Polymeros
  • 823
  • 1
  • 8
  • 19
  • 1
    You don't need to use cbind when creating a data frame. It's slower and less readable than simply `data.frame(x=1, y=1:10)`. – Richie Cotton Dec 22 '11 at 14:05

1 Answers1

2

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.

jverzani
  • 5,600
  • 2
  • 21
  • 17