Why does the select.files () file not open in the current working directory?

When I change the working directory (for example, from dir1 to dir2), try using select.files (), the first time select.files () starts it in dir1. If I canceled and ran select.files () a second time, then it opens in the dir2 directory. How can I get select.files () to open in the current working directory itself?

(I ran into another problem with file.choose (), so I cannot use this function as a replacement)

Here is an example:

getwd()                # say this is dir1
setwd(choose.dir())    # here I change the wd to dir2
getwd()                # currently set to dir2
choose.files()         # this opens in dir1
choose.files()         # this time it opens in dir2

I would like to use this progression to select a file from the current working directory. Appreciate any ideas. Thanks!

+4
source share
1 answer

default:

choose.files(default=paste0(getwd(), "/*.*")) 

?choose.files:

, (, "c:\*. *" ) .

+2

Source: https://habr.com/ru/post/1617503/


All Articles