dplyr’s anti_join() to find rows based on presence or absence in a dataframe

In this tutorial, we will learn how to use dplyr’s anti_join() function to filter rows from one dataframe based on the presence or absence of matches in another dataframe. dplyr’s anti_join() function is extremely useful for cases when we want to find what row is present or missing in a dataframe when compared to another… Continue reading dplyr’s anti_join() to find rows based on presence or absence in a dataframe

tidyr’s separate_delim_wider(): Split a string into columns

In this tutorial, we will learn how to split a string in a column into multiple columns using a delimiter. We will use tidyr’s separate_delim_wider() function, that separates a string in a column into multiple columns using delimiter. After spliting the dataframe is wider with more columns. We will start with a simple example of… Continue reading tidyr’s separate_delim_wider(): Split a string into columns

How to select rows with multiple partial matching strings

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

How to compute annualized return of a stock with tidyverse

In this tutorial, we will learn how to compute annualized return of stock using tidyverse from scratch. Annualized return of an investment is the average returns of the investment that is held over many years. In comparison to simple mean of yearly returns, annualized return is a geometric mean and it accounts for the compounding… Continue reading How to compute annualized return of a stock with tidyverse

How to get product of all elements in a column

In this tutorial we will learn how to compute product of all elements of a column in a dataframe using tidyverse. We will use prod() function in base to multiple all elements of a columns. Let us first load tidyverse. We will create a simple dataframe using tidyverse’ tibble() with a column containing numbers from… Continue reading How to get product of all elements in a column

Exit mobile version