[R] Having a problem with choose.files
Carl.Finkbeiner at tnsglobal.com
Carl.Finkbeiner at tnsglobal.com
Sun Mar 13 12:11:54 CET 2011
I am relatively new to R, and am having a problem with the following
snippet of code, and I do not at all understand why it is behaving this
way. I am running Windows XP, with R 2.12.1.
I copy and paste these 4 lines into the R Console:
t<-c("a","b","c")
ans<-select.list(t)
txtNBS<-winDialogString("NBS","300")
choose.files()
I click on OK in the Select One dialog, and on OK in the Question
dialog, and then Cancel in the file dialog. Everything behaves as I
expect it to. (All 3 of those dialog functions are in the utils
package.)
I then copy and paste these 6 lines defining the function fn, into the R
Console. Note that the body of the function is exactly the same as the
4 lines above that worked well.
fn<-function() {
t<-c("a","b","c")
ans<-select.list(t)
txtNBS<-winDialogString("NBS","300")
choose.files()
}
When I then invoke this function by typing fn() into the R Console, I
again click OK in the Select One dialog, and on OK in the Question
dialog. BUT, the file dialog never appears. Furthermore, if I then
type choose.files() into the R Console, about half the time the file
dialog appears and about half the time it doesn't.
Any help anyone can give me is much appreciated. I cannot see what I am
doing wrong here.
Thanks,
Carl Finkbeiner
More information about the R-help
mailing list