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
How to Generate Random Numbers from Uniform Distribution
In this tutorial, we will learn how to simulate or generate random numbers from uniform distribution. In R, with the in-built function runif() we can generate uniform random numbers. The basic usage of runif() function looks like this where n refers to the number of … [Read more...] about How to Generate Random Numbers from Uniform Distribution
How to create a directory if it does not exist in R
In this tutorial we will learn how to create a directory if it does not exist already using R. We will be using two base R functions, one of checking if a directory exists and the other for creating a directory. If a directory exists already we would not be creating it and if … [Read more...] about How to create a directory if it does not exist in R