Simple linear regression with tidyverse

In this tutorial we will learn how to perform simple linear regression between two numerical variables in R using lm() function. The resulting object from a linear regression analysis using lm() is unwieldy and not intuitive for beginners. We use broom package that is part of tidymodels to make the messy output from lm() into… Continue reading Simple linear regression with tidyverse

How to apply a function on multiple columns using across()

In this post, we will learn how to compute one or multiple functions on multiple columns using dplyr’s across() function. dplyr’s across() function can be used with summarize() or mutate() functions to operate on columns. In this example we will use summarize() function to compute mean values of multiple columns at the same time using… Continue reading How to apply a function on multiple columns using across()

How to Change Column Name with a variable name

In this post we will learn how to rename a column name in a dataframe with another name saved in a variable using dplyr. We will use dplyr’s rename() function in combination with special functions that are part of tidyverse’s tidy eval functionalities. First, let us load tidyverse and check the installed dplyr’s version. We… Continue reading How to Change Column Name with a variable name

dplyr case_when() to create new variable using multiple conditions

In this tutorial, we will learn how to use dplyr’s case_when() function to create a new variable based on multiple conditions. dplyr’s case_when() function offers a genereal solution when you might needed multiple if_else() conditions. In this blog post, we’ll explore case_when() function with multiple examples. Let us start with creating a simple data frame… Continue reading dplyr case_when() to create new variable using multiple conditions

Exit mobile version