# How to Drop Unused Factor Levels in a Subsetted Data Frame in R

This tutorial explains a simple way to drop unused factor levels in a data frame in R. Dropping Unused Factor Levels Suppose we have the…

# Interpreting Errors in R: ‘max’ not meaningful for factors

At one point or another you may encounter the following error in R: ‘max’ not meaningful for factors This simply indicates that you are attempting…

# How to Create a For Loop in R and Append Results to a Vector

One common procedure you may want to perform in R is using a for loop to repeat some process several times, then appending the results…

# ifelse() Function in R

The built-in ifelse() function in R allows you to conduct a logical test and return values based on the result of the test. The basic…

# A Guide to Permutation Tests

A permutation test (sometimes called a randomization test) is a way to test for a difference in outcomes between different treatment groups. This tutorial explains…

# How to Easily Find the Standard Deviation of Specific Columns in R

Suppose we have the following data frame in R: #create a data frame with three columns and five rows data <- data.frame(a = c(1, 2,…

# How to Calculate the Mode in R

The mode is the value that occurs most often in a dataset. For example, the mode of the following list of numbers is 12, since that…

# Working With Strings in R – paste, paste0, and sprintf

This tutorial explains how to work with strings in R using the functions paste, paste0, and sprintf. Using paste & paste0 The paste() function converts…

# How to Read and Interpret a Regression Table

In statistics, regression is a technique that can be used to analyze the relationship between predictor variables and a response variable. When you use software…

# Regular Expressions in R

Often when you’re working with datasets, you may want to search or replace strings. Fortunately R has many built-in functions to help you do so.…