[R] Widget inserts NA instead of entered data

Windy Berkofsky-Fessler windy.berkofsky-fessler at mssm.edu
Thu Apr 27 17:37:17 CEST 2006


I am relatively new to R and extremely new to widgets.  Any help would 
be greatly appreciated!  The script below is a portion of a larger 
script in which the user has entered the number of files representing 
their transcription factor (in this case 2) and their control (again 
2).  In this portion, I would like the user to indicate which files 
(from 1-4, in this case) are transcription factor data (1 and 2) and 
which are control (3 and 4).  The problem is that whenever I run the 
script and enter "1" and "2"  and "3" and "4"in the widget boxes, the 
values returned at "NA" and "2" and "NA" and "4".  Does anyone know why 
the first values are being returned as NA?  Any ideas on how to fix 
this?  I am using R 2.2.1 on Windows XP Pro.  Thanks!

library(tkWidgets)
library(widgetTools)

PWEnv<-new.env(hash=TRUE, parent=parent.frame(1))   
tf.count.2<-2
ctrl.count.2<-2
  
entry2<- entryBox(wName = "entry2", wValue= "", wEnv=PWEnv)
entry3<- entryBox(wName = "entry3", wValue="", wEnv=PWEnv)
label4<-label(wName="label4", wValue="Please enter the number for one of 
the _635 files that
represent your transcription factor.", wEnv=PWEnv)
label5<-label(wName="label5", wValue="Please enter the number for one of 
the _635 files that
represent your controls.", wEnv=PWEnv)

for (i in 1:tf.count.2){
pWidgets<-list(topRow=list(label4=label4), textRow=list(entry2=entry2))
aWidget<-widget(wTitle="Assign Experimental Files", pWidgets, env=PWEnv)
tf<-c()
tf[i]<-wValue(pWidgets(aWidget)[["textRow"]][["entry2"]])}

for (i in 1:ctrl.count.2){
pWidgets<-list(topRow=list(label5=label5), textRow=list(entry3=entry3))
aWidget<-widget(wTitle="Assign Control Files", pWidgets, env=PWEnv)
ctrl<-c()
ctrl[i]<-wValue(pWidgets(aWidget)[["textRow"]][["entry3"]])}


 > ctrl
[1] NA  "4"
 > tf
[1] NA  "2"
 >


Windy Berkofsky-Fessler
Graduate School of Biological Sciences
Mount Sinai School of Medicine
New York, NY 10029




More information about the R-help mailing list