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

slice_min: Get Rows with minimum values of a column

dplyr's slice_min(): Rows with lowest values for a column

In this tutorial, we will learn how to get rows with lowest values of a column from a data frame in R. We will use dplyr’s slice_min() function to select rows with lowest values for a column in a data frame. We will also use slice_min() function in dplyr to find the bottom n rows… Continue reading slice_min: Get Rows with minimum values of a column

Many linear regression models with tidyverse

In this tutorial, we will learn how to build many simple linear regression models in R using tidyverse. We will start with a simple approach that is not scalable to illustrate the challenges. Then we will show a naive approach using for loop to build many linear regression models. And finally we will show an… Continue reading Many linear regression models with tidyverse

Exit mobile version