Articles by Andrew Treadway

How to hide a password in R with the keyring package

June 25, 2019 | Andrew Treadway

This post will introduce using the keyring package to hide a password. Short background The keyring package is a library designed to let you access your operating system’s credential store. In essence, it lets you store and retrieve passwords in your operating system, which allows you to avoid having ...
[Read more...]

Does “Sell in May, Go Away” really work?

June 11, 2019 | Andrew Treadway

If you follow the stock market, you’ve probably heard the expression “Sell in May, Go Away.” This expression generally refers to the perceived idea that the stock market goes up between the end of October and end of April, but one should sell at the beginning of May to ...
[Read more...]

Four ways to reverse a string in R

May 16, 2019 | Andrew Treadway

R offers several ways to reverse a string, include some base R options. We go through a few of those in this post. We’ll also compare the computational time for each method. Reversing a string can be especially useful in bioinformatics (e.g. finding the reverse compliment of a ...
[Read more...]

Don’t forget the “utils” package in R

April 3, 2019 | Andrew Treadway

With thousands of powerful packages, it’s easy to glaze over the libraries that come preinstalled with R. Thus, this post will talk about some of the cool functions in the utils package, which comes with a standard installation of R. While utils comes with several familiar functions, like read....
[Read more...]

Speed Test: Sapply vs. Vectorization

March 13, 2019 | Andrew Treadway

The apply functions in R are awesome (see this post for some lesser known apply functions). However, if you can use pure vectorization, then you’ll probably end up making your code run a lot faster than just depending upon functions like sapply and lapply. This is because apply functions ...
[Read more...]

Creating a word cloud on R-bloggers posts

January 29, 2019 | Andrew Treadway

This post will go through how to create a word cloud of article titles scraped from the awesome R-bloggers. Our goal will be to use R’s rvest package to search through 50 successive pages on the site for article titles. The stringr and tm packages will be used for string ...
[Read more...]

Those “other” apply functions…

November 13, 2018 | Andrew Treadway

So you know lapply, sapply, and apply…but…what about rapply, vapply, or eapply? These are generally a little less known as far as the apply family of functions in R go, so this post will explore how they work. rapply Let’s start with rapply. This function has a ...
[Read more...]

How to run R from the Task Scheduler

October 31, 2018 | Andrew Treadway

In a prior post, we covered how to run Python from the Task Scheduler on Windows. This article is similar, but it’ll show how to run R from the Task Scheduler, instead. Similar to before, let’s first cover how to R from the command line, as knowing this ...
[Read more...]

Dpylthon…dplyr for Python!

September 5, 2018 | Andrew Treadway

If you’re an avid R user, you probably use the famous dplyr package. Python has a package meant to be similar to dplyr, called dplython. This article will give an introduction for how to use dplython. For the examples below, we’ll use a sample dataset that comes with ...
[Read more...]

Getting data from PDFs the easy way with R

August 24, 2018 | Andrew Treadway

Earlier this year, a new package called tabulizer was released in R, which allows you to automatically pull out tables and text from PDFs. Note, this package only works if the PDF’s text is highlightable (if it’s typed) — i.e. it won’t work for scanned-in PDFs, or ...
[Read more...]

How to get live stock prices with Python

July 31, 2018 | Andrew Treadway

In a previous post, I gave an introduction to the yahoo_fin package. The most updated version of the package includes new functionality allowing you to scrape live stock prices from Yahoo Finance (real-time). In this article, we’ll go through a couple ways of getting real-time data from Yahoo ...
[Read more...]

How to download image files with RoboBrowser

July 16, 2018 | Andrew Treadway

In a previous post, we showed how RoboBrowser can be used to fill out online forms for getting historical weather data from Wunderground. This article will talk about how to use RoboBrowser to batch download collections of image files from Pexels, a site which offers free downloads. If you’re ...
[Read more...]

ICA on Images with Python

June 23, 2018 | Andrew Treadway

Click here to see my recommended reading list. What is Independent Component Analysis (ICA)? If you’re already familiar with ICA, feel free to skip below to how we implement it in Python. ICA is a type of dimensionality reduction algorithm that transforms a set of variables to a new ...
[Read more...]

Coding with the Yahoo_fin Package

January 24, 2018 | Andrew Treadway

Subscribe to TheAutomatic.net via the area on the right side of the page. The yahoo_fin package contains functions to scrape stock-related data from Yahoo Finance and NASDAQ. You can view the official documentation by clicking this link, but the below post will provide a few more in-depth examples. ...
[Read more...]

Timing Python Processes

January 14, 2018 | Andrew Treadway

Timing Python processes is made possible with several different packages. One of the most common ways is using the standard library package, time, which we’ll demonstrate with an example. However, another package that is very useful for timing a process — and particularly telling you how far along a process ...
[Read more...]

Underrated R Functions

December 30, 2017 | Andrew Treadway

I wanted to write a post about a couple of handy functions in R that don’t always get the recognition they deserve. This article will talk about a few functions that form part of R’s core functional programming capabilities. R has thousands of functions, so this is just ...
[Read more...]
1 2 3

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)