Ten Time-saving R Hacks

I use these regularly to try to minimize distractions and keep up my production pace

Keith McNulty
9 min readOct 5, 2023

--

Photo by ThisisEngineering RAEng on Unsplash

The more coding I do, the more sensitive I become to inefficiency. For me, Nirvana is where you can code super quickly without having to do stuff outside your favorite code editor.

So I get pretty frustrated when I can’t do what I want using lean, efficient code, or when I have to go into my filesystem or another program to configure something, or anything else that I view as taking up unnecessary time and effort.

Here are ten hacks I use regularly to try to minimize distractions and keep up my production pace. When I tell some people about these, I often get a few reactions like ‘Why didn’t I know about this?’. So I hope at least some of these will be new and useful to you.

1. Downloading and reading files straight from source

This tip should help you minimize time administering local data files and make your entire project more replicable by others. If you have a data file which is sitting on the web somewhere, like in Google Drive or some other URL, the readr package allows you to read it direct from the URL into a dataframe, using functions like read_csv() or read_rds(). For example:

--

--

Keith McNulty

Pure and Applied Mathematician. LinkedIn Top Voice in Tech. Expert and Author in Data Science and Statistics. Find me on LinkedIn, Twitter or keithmcnulty.org