I work between Mac and PC (home and work, respectively), so I guess my pain is similar in some ways.
Although, in my case, 2 worlds rarely intersect - at work, I work on work projects, and at home - I work on home projects.
I can’t offer a complete process (I don’t have one, shame on me!), but I’ve got a few tips:
- the segment you quoted from R for DS book, times ten. Setting up a working directory is the first step.
- I’ve found that while local directories can be unique on every machine, web links are usually all the same. In my work, I frequently reference files via a web link and not via its location on the drive. So, let’s say you have a folder on your local drive that syncs to the web (Dropbox, G Drive, Sharepoint etc). Using a web link for that file will make your code reproducible and scalable, while setting the path to User/your_name/some_folder/some_file will warrant @jennybryan to come to your office and set your machine on fire.
- sometimes, when I’m lazy, I create 2 paths, path_mac and path_pc, and use them interchangeably. There is a way for R to figure out your OS, so you can make it a function with a simple if_else switch, and let your script pick the path you need. But this is definitely not the best approach. Quick and dirty, but I wouldn’t use it in production.