Publications by Andrew Treadway

3 recommended books on learning R

24.02.2020

I sometimes get asked how I got started learning R. I thought I would use this post to go through a few books I read along the way which have been highly useful. The Art of R Programming The Art of R Programming: A Tour of Statistical Software Design is one of the first R books I read. If you read the table of contents of this book, you’ll se...

3046 sym 4 img

How to create decorators in R

16.03.2020

Introduction One of the coolest features of Python is its nice ability to create decorators. In short, decorators allow us to modify how a function behaves without changing the function’s source code. This can often make code cleaner and easier to modify. For instance, decorators are also really useful if you have a collection of functions w...

4493 sym R (1332 sym/11 pcs) 10 img

What to study if you’re under quarantine

23.03.2020

If you’re staying indoors more often recently because of the current COVID-19 outbreak and looking for new things to study, here’s a few ideas! Free 365 Data Science Courses 365 Data Science is making all of their courses free until April 15. They have a variety of courses across R, Python, SQL, and more. Their platform also has courses tha...

2001 sym 2 img

Make your Amazon purchases with R!

20.04.2020

Background Anyone who’s bought groceries online recently has seen the huge increase in demand due to the COVID-19 outbreak and quarantines. In this post, you’ll learn how to buy groceries on Amazon using R! To do that, we’ll be using the RSelenium package. In case you’re not familiar, Selenium is a browser automation tool. It works l...

5514 sym R (3874 sym/9 pcs) 6 img

How to schedule R scripts

11.05.2020

Running R with taskscheduleR and cronR In a previous post, we talked about how to run R from the Windows Task Scheduler. This article will talk about two additional approaches to schedule R scripts, including using the taskscheduleR package on Windows and the cronR package for Linux. For scheduling Python code, check out this post. Schedule R s...

4762 sym R (2404 sym/20 pcs) 2 img

How to read and create Word Documents in R

21.07.2020

Reading and creating word documents in R In this post we’ll talk about how to use R to read and create word files. We’ll primarily be using R’s officer package. For reading data from Word Documents with Python, click here. Creating Word reports with the officer package The first thing we need to do is to install the officer package. inst...

3079 sym R (1838 sym/12 pcs) 10 img

How to create PowerPoint reports with R

27.07.2020

In my last post, we discussed how to create and read Word files with R’s officer package. This article will expand on officer by showing how we can use it to create PowerPoint reports. Getting started Let’s get started by loading officer. library(officer) Next, we’ll create a PowerPoint object in R using the read_pptx function. pres <-...

2386 sym R (2250 sym/9 pcs) 8 img

How to create an API for your R code

17.08.2020

In the video linked below we discuss how to convert your R code into an API using the awesome plumber package! Learn more by clicking here or by following the links below. The plumber package allows you to convert R functions into API calls. For example, rather than launching R and executing a function, you can use plumber to turn the function...

1620 sym 2 img

Why you should use vapply in R

19.10.2020

In this post we’ll cover the vapply function in R. vapply is generally lesser known than the more popular sapply, lapply, and apply functions. However, it is very useful when you know what data type you’re expecting to apply a function to as it helps to prevent silent errors. Because of this, it can be more advisable to use vapply rather t...

2534 sym R (312 sym/6 pcs) 6 img

How to solve Sudoku with R

25.11.2020

In this post we discuss how to write an R script to solve any Sudoku puzzle. There are some R packages to handle this, but in our case, we’ll write our own solution. For our purposes, we’ll assume the input Sudoku is a 9×9 grid. At the end result, each row, column, and 3×3 box needs to contain exactly one of each integer 1 through 9. Lea...

2033 sym R (1931 sym/5 pcs) 6 img