문제

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
도움이 되었습니까?

해결책

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

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top