Question

After making changes to a data frame using gdf, how do I retrieve the dataframe I have created?

Sample code:

require("gWidgets2RGtk2")
## Sample Data frame
x<-data.frame(a=c(1,2,3),b=c(4,5,6))
## Create Widget
w<-gwindow("gdf")
a<-gdf(x,cont=w)
## Makes some changes using widget
svalue(a)
> NULL
Was it helpful?

Solution

Managed to figure out the solution, although it doesn't seem very logical!

a  #Doesn't work
# Object of class GDf 
a[1:nrow(a),1:ncol(a)]  # Works
#    a  b
# 1  1  4
# 2  2  5
# 3  3  6
#   NA NA
str(a[1:nrow(a),1:ncol(a)]) #Shows that this is a data frame
# 'data.frame': 4 obs. of  2 variables:
#  $ a: num  1 2 3 NA
#  $ b: num  4 5 6 NA

OTHER TIPS

To retrieve the value of the gdf object, you need to do the following (using your example):

a[]

This doesn't seem to be documented in ?gdf, so maybe a bug report is in order.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top