Quick R tip- making scripts work across OS’s

Quick thought for newbies to R. I have spent four years loading in data like this


on my Windows machine and like this


on my Linux machine. I would comment out the one I wasn’t using at the time.

It’s fine for a while but once you start reading multiple dataframes (particularly if they’re not all loaded at the start) it gets very fiddly and annoying. Don’t do this. Just set your working directory. You can do it manually:


Or, even better, the seamless option:


Mmm, I can almost taste the hours I’ll save in the course of a year.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.