In this tutorial, we will learn how to collapse multiple rows from a column to a single row based on another column/group. Let us get started by loading tidyverse and checking the tidyr package version. To illustrate collapsing multiple rows into single one, let us … [Read more...] about How to collapse multiple rows based on a column
R Function
How to select columns that starts with a prefix/string in R
In this tutorial, we will learn how to select columns that starts with a prefix or string using dplyr's strats_with() function and base R startsWith() function. The tidyverse R package dplyr has a number of helper functions to select columns of interest under different … [Read more...] about How to select columns that starts with a prefix/string in R
Linear Regression in R with lm() function – A Practical Tutorial
In this tutorial, we will learn how to perform a simple linear regression in R using lm() function. Simple Linear regression is one of the popular and common statistical methods that is used to understand the relationship between two numerical or quantitative variables, like … [Read more...] about Linear Regression in R with lm() function – A Practical Tutorial
How To find levels of a factor in R
Factors are a type of variable that R uses to store categorical information in R. For example, we can save sexes as factor variable with two values male and female. In this post we will learn about using factor variables in R and learn how to find out about levels of a factor … [Read more...] about How To find levels of a factor in R
How to Split a Dataframe into a list of Dataframes by groups in R
In this tutorial, we will learn how to split a dataframe into a list of dataframes by groups in R. We will first learn how to use the base R function, split(), to divide a dataframe into multiple dataframes into a list. Then, we will learn how to use dplyr's group_split() … [Read more...] about How to Split a Dataframe into a list of Dataframes by groups in R