## Find nth largest or smallest in a group

You want to identify the nth largest or smallest item in a group using R. For example, to filter out the two rows in the table below: Any time there …

## Calculate percent of column in R

You want to calculate percent of column in R as shown in this example, or as you would in a PivotTable: Here are two ways: (1) using Base R, (2) …

## How to do MID, RIGHT an LEFT in R

MID(), LEFT() and RIGHT() make it easy to extract parts of strings in Excel. Let’s see how we apply those in R. Using substr() Let’s start with a simple example …

## Excel Formulas and R Functions

Below is a short list of basic, commonly-used Excel formulas and their R counterparts. The R functions are part of Base R, in that they do no require third-party packages. …

## Column to Text in R

This is not an Excel feature, although it should be! Often times we have a list of things in a column that needs to be combined into, say, a comma-delimited …

## How to do VLOOKUP in R

VLOOKUP is usually the first magical formula people learn when learning Excel. The magic never goes away. So let’s see how to do a VLOOKUP in R. Situation Let’s say …

## How to Make a PivotTable in R

The Excel PivotTable is plain awesome. In this post I will show you how to make a PivotTable in R (kind of). We will use two popular libraries, dplyr and …

## Excel vs R: When to use what

Believe it or not, Excel is still my go-to analysis tool a lot of times, because it’s great at what it does.  I’m a shortcut fiend, so I can do …