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…

# Author: admin

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…

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…

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 permutation test (sometimes called a randomization test) is a way to test for a difference in outcomes between different treatment groups. This tutorial explains…

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,…

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…

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

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…

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.…