Topics
- Learn R: Introduction
- Learn R: Data Frames
Learn R: Data Cleaning
- Learn R: Fundamentals of Data Visualization with ggplot2
- Learn R: Aggregates
- Learn R: Joining Tables
- Learn R: Mean, Median, and Mode
- Learn R: Variance and Standard Deviation
- Learn R: Quartiles, Quantiles, and Interquartile Range
- Learn R: Hypothesis Testing
gsub[] R Function
The base R gsub[]
function searches for a regular expression in a string and replaces it. The function recieve a string or character to replace, a replacement value, and the object that contains
the regular expression. We can use it to replace substrings within a single string or in each string in a vector.
When combined with dplyr’s mutate[]
function, a column of a data frame can be cleaned to enable analysis.
# Replace the element "1" with the empty string in the teams vector in order to get the teams_clean vector with the correct names.
teams