[R] Having a problem with choose.files

Duncan Murdoch murdoch.duncan at gmail.com
Sun Mar 13 13:46:53 CET 2011


On 11-03-13 7:11 AM, Carl.Finkbeiner at tnsglobal.com wrote:
> 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.

Looks like a bug in one of those functions.  I'll look into it.

Duncan Murdoch



More information about the R-help mailing list