R
How to Add an Index (numeric ID) Column to a Data Frame in R
Suppose you have the following data frame:
data
...
R
How to Generate a Sample Using the Sample Function in R
The sample() function in R allows you to take a random sample of elements from a dataset or a vector, either with or without replacement.
The basic...
R
How to Rename Data Frame Columns in R
This tutorial explains how to rename data frame columns in R using a variety of different approaches.
For each of these examples, we’ll be working...
R
A Guide to apply(), lapply(), sapply(), and tapply() in R
This tutorial explains the differences between the built-in R functions apply(), sapply(), lapply(), and tapply() along with examples of when and how to use...
R
How to Extract Specific Columns from Data Frame in R
You can use the following methods to extract specific columns from a data frame in R:
Method 1: Extract Specific Columns Using Base R
df
Method 2:...
R
R: The Difference Between ifelse() vs. if_else()
There are three advantages that the if_else() function in dplyr has over the ifelse() function in base R:
1. The if_else() function verifies that both...
R
How to Remove Duplicate Rows in R so None are Left
You can use the following methods in R to remove duplicate rows from a data frame so that none are left in the resulting...
Subscribe
- Never miss a story with notifications
- Gain full access to our premium content
- Browse free from up to 5 devices at once
Must read