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 we load tidyverse the suit of R… Continue reading 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 random numbers we need and min/max is the interval of… Continue reading 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 the… Continue reading How to create a directory if it does not exist in R

dplyr filter(): How to select rows with partially matching string

In this tutorial, we will learn how to select or filter rows of a dataframe with partially matching string. dplyr’s filter() function selects/filters rows based on values of one or more columns when it completely matches. However, to filter or select rows with partially matching strings in a column, we can use filter with additional… Continue reading dplyr filter(): How to select rows with partially matching string

How to filter rows in a dataframe: dplyr’s filter()

With dplyr’s filter() function, one can filter rows or subset rows from a dataframe. In this post, we will learn how to select subset of rows based on values one or more columns in a dataframe using dplyr’s filter() function. First we load tidyverse the suit of R packages. We will use world population dataset… Continue reading How to filter rows in a dataframe: dplyr’s filter()

Exit mobile version