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 … [Read more...] about Many linear regression models with tidyverse
rstats101
How to do inner join with dplyr in R
In this post, we will learn how to do an inner join in R with dplyr's inner_join(). An inner join between two dataframes x and y, gives is the only rows from x for which we have a matching key in y. First, load tidyverse suit of packages and check the version of dplyr … [Read more...] about How to do inner join with dplyr in R
Join dataframes by different column names with dplyr
In this tutorial, we will learn how to join dataframes by columns with different names in the two dataframes. dplyr offers a great set of tools to join or merge dataframes. We will use two approaches to merge two dataframe by different names. We will start with … [Read more...] about Join dataframes by different column names with dplyr
slice_max: get rows with highest values of a column
In this tutorial, we will learn how to get rows with maximum values of a column or variable from a dataframe. For example, from a dataframe with multiple rows and columns we will find a row (or multiple rows) with maximum values for a column. We will use dplyr's slice_max() … [Read more...] about slice_max: get rows with highest values of a column
How to Calculate Rolling Mean in R
In this tutorial, we will learn how to compute rolling mean of a column in a dataframe in R. Rolling mean often useful in time series data analysis is also known as moving average or running average calculates average of data points over window of specified size. In R, we can … [Read more...] about How to Calculate Rolling Mean in R