Many of us have been writing code for Windows and Linux (and OS X ...) for years. Construct yourself little helper functions
isLinux <- function() unname(Sys.info()["sysname"]) == "Linux"
and likewise for Windows. Then construct your path programmatically:
Many of us have been writing code for Windows and Linux (and OS X ...) for years. Construct yourself little helper functions
isLinux <- function() unname(Sys.info()["sysname"]) == "Linux"
and likewise for Windows. Then construct your path programmatically:
ourRootDir <- function() ifelse( isLinux(), "/opt/data/someThing", "D:/data")
via
datapath <- file.path( ourRootDir(), "project", "some", "where")
and afterwards all actual analysis commands will most likely be portable without change.
Among the 4200+ CRAN package, very few do not exist on all platforms.
Also, data written via
save()
on one system can be loaded on another and as this is a binary format with compression, you also save a lot of time.https://stackoverflow.com/questions/14923800/how-to-run-r-code-written-under-windows-in-linux