In this tutorial we will learn how to use dplyr's between() function to find if one or more numerical values are in a range using multiple examples. We will first start with a single numeric value and find out if it is within a range. And then in the next example, we will use a … [Read more...] about dplyr between(): find if numerical values are within a range.
dplyr
How to Randomly Replace Values of Numerical Columns in a dataframe to NAs
In this tutorial, we will learn how to randomly replace values of numerical columns in a dataframe to NAs or missing values. We will use dplyr's across() function to select only the numerical columns from a dataframe and probabilistically select certain percent of elements to … [Read more...] about How to Randomly Replace Values of Numerical Columns in a dataframe to NAs
dplyr contains(): select columns that contains a string
In this tutorial, we will learn how to select columns, whose names contains a string using dplyr's contains() function. dplyr's contains() function belongs to a family helper functions to select columns like starts_with() and ends_with(). First we will see a simple example of … [Read more...] about dplyr contains(): select columns that contains a string
dplyr transmute(): add new columns and delete existing columns
In this tutorial, we will learn how to create new columns and remove existing columns using dplyr's transmute() function. We will start with an example showing how to use transmute to create one new column and then show an example of creating more than one new column. First, … [Read more...] about dplyr transmute(): add new columns and delete existing columns
dplyr’s mutate(): How to create new columns
In this tutorial, we will learn how to create/add one or more columns to a dataframe using dplyr's mutate() function. We will first see an example of creating a single new column in a dataframe and then see an example of adding multiple columns using mutate() function. First … [Read more...] about dplyr’s mutate(): How to create new columns