user interface - "Add" Button for Data Frame Editing GUI in R -
i'm trying create gui in r user can add, edit, or search entries within data frame. adding new entry created "add" button opens new window. code follows:
add <- gbutton("add entry", handler = function(h,...){ input <- gwindow("input new entry") vals <- ggroup(horizontal = f, use.scrollwindow = t, container = input) cols <- 1:length(colnames(data)) text <- vector() (n in cols) { adds <- gedit(initial.msg = colnames(data)[n], container = vals) text[n] <- adds[] } save <- gbutton("add entry",horizontal = f, handler = function(h,...){ tab[dim[1]+1,] <- text dim[1] = dim[1] + 1 dispose(input) }, container = vals) }, container = bttns)
for reference data
original data frame used, dim
vector dimensions of data frame, bttns
group in add
button appears in original window, , tab
data frame table added in original window gdf
.
my goal create gedit
each column entry in data
, append new entry last row in original data frame. creating each gedit
manually seems defeat purpose of computer programming. there way can save vector of widgets? preceding code doesn't give errors, doesn't save data after entered new window. there easier way other using loop? appreciated!
Comments
Post a Comment