relative path with list.files in shiny app

I develop a shiny app at job.
After an update of my laptop and reinstallation of R/Rstudio by TI, some function with path doesn't work anymore.
For example :

temp_PSEP <- list.files(path = '~/Statal/Data', pattern = "PSEP.*SRAM.csv")

return "empty"

path.expand('~')

return //alp/Userdata$/Adm/user/Documents
If I replace the path by an absolute path in list.files, it works.
I don't understand. Do i need to play with environment variable ?
Thanks !

Hi,

I'm not an expert in this, but if you run Sys.getenv() the R_USER variable should correspond to the tilde (~) path.

What could happen is that if the code is executed under a different user, this could lead to issues

PJ

Thanks for the answer.
Sys.getenv(), R_USER return the same path than tilde path.
I'm the only user of R at my job ... :confused:

Hi,

Since you are the only user you could just set the full path then I guess, though it is indeed a bit weird. Personally I don't use the tilde in paths, I either use full paths or relative from the working folder (or Shiny folder in this case).

PJ

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.