Blog Archives

Four ways to reverse a string in R

May 16, 2019
By
Four ways to reverse a string in R

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 DNA strand). To get started, let’s generate The post Four ways...

Read more »

Don’t forget the “utils” package in R

April 3, 2019
By
Don’t forget the “utils” package in R

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.csv, write.csv, and help, it also contains The post Don’t forget...

Read more »

Speed Test: Sapply vs. Vectorization

March 13, 2019
By
Speed Test: Sapply vs. Vectorization

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 like these still rely on looping The post Speed Test:...

Read more »

Creating a word cloud on R-bloggers posts

January 29, 2019
By
Creating a word cloud on R-bloggers posts

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 cleaning and for creating a The post Creating a...

Read more »

So you want to play a pRank in R…?

December 18, 2018
By
So you want to play a pRank in R…?

So…you want to play a pRank with R? This short post will give you a fun function you can use in R to help you out! How to change a file’s modified time with R Let’s say we have a file, test.txt. What if we want to change the last modified date of the file The post So you...

Read more »

10 R functions for Linux commands and vice-versa

December 10, 2018
By
10 R functions for Linux commands and vice-versa

This post will go through 10 different Linux commands and their R alternatives. If you’re interested in learning more R functions for working with files like some of those below, also check out this post. How to list all the files in a directory Linux R What does it do? ls list.files() Lists all the The post 10 R...

Read more »

Those “other” apply functions…

November 13, 2018
By
Those “other” apply functions…

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 couple of different purposes. One is to recursively The post Those “other”...

Read more »

How to run R from the Task Scheduler

October 31, 2018
By
How to run R from the Task Scheduler

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 is useful for running it from the The post How to...

Read more »

How to build a logistic regression model from scratch in R

October 2, 2018
By
How to build a logistic regression model from scratch in R

In a previous post, we showed how using vectorization in R can vastly speed up fuzzy matching. Here, we will show you how to use R’s vectorization functionality to efficiently build a logistic regression model. Now we could just use the caret or stats packages to create a model, but building algorithms from scratch is The post How to...

Read more »

Dpylthon…dplyr for Python!

September 5, 2018
By
Dpylthon…dplyr for Python!

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 R giving attributes about the US states, The post Dpylthon…dplyr for...

Read more »

Search R-bloggers

Sponsors

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)