Yes, file.path()
R> file.path("usr", "local", "lib")
[1] "usr/local/lib"
R>
There is also the equally useful system.path()
for files in a package:
R> system.file("extdata", "date_time_zonespec.csv", package="RcppBDT")
[1] "/usr/local/lib/R/site-library/RcppBDT/extdata/date_time_zonespec.csv"
R>
which will get the file extdata/date_time_zonespec.csv
irrespective of
- where the package is installed, and
- the OS
which is very handy. Lastly, there is also
R> .Platform$file.sep
[1] "/"
R>
if you insist on doing it manually.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…