[R] Problem with path.expand("~")
Thierry Onkelinx
thierry.onkelinx at inbo.be
Tue Aug 11 16:41:12 CEST 2015
Dear all,
I'm puzzled by the behaviour of path.expand("~")
In the RStudio IDE the output is
> path.expand("~")
[1] "C:/Users/thierry_onkelinx/Documents"
In the R GUI the output is
> path.expand("~")
[1] "~"
But I'm expecting the same result as in the RStudio IDE. The "Start in"
parameter of shortcut to the R GUI has the value
"C:\Users\thierry_onkelinx\Documents"
The problem is that I use normalizePath("~/analysis"). This
yield "C:\\Users\\thierry_onkelinx\\Documents\\analysis" in RStudio
It throws an error in the R GUI
"C:\\Users\\thierry_onkelinx\\Documents\\~\\analysis"
Warning message:
In normalizePath(path.expand(path), winslash, mustWork) :
path[1]="~/analysis": Het systeem kan het opgegeven pad niet vinden
# sessionInfo() in RStudio
R version 3.2.1 (2015-06-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=Dutch_Belgium.1252 LC_CTYPE=Dutch_Belgium.1252
LC_MONETARY=Dutch_Belgium.1252
[4] LC_NUMERIC=C LC_TIME=Dutch_Belgium.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] tools_3.2.1 fortunes_1.5-2
# sessionInfo() from R GUI
R version 3.2.1 (2015-06-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=Dutch_Belgium.1252 LC_CTYPE=Dutch_Belgium.1252
[3] LC_MONETARY=Dutch_Belgium.1252 LC_NUMERIC=C
[5] LC_TIME=Dutch_Belgium.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] tools_3.2.1 fortunes_1.5-2
Best regards,
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belgium
To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to say
what the experiment died of. ~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data. ~ Roger Brinner
The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey
[[alternative HTML version deleted]]
More information about the R-help
mailing list