In this tutorial, we will learn how to separate a column with multiple elements separated by a delimiter into different rows. We will use tidy's separate_rows() function first to separate a column with comma separated elements. And then show how to use separate_rows() on multiple … [Read more...] about How to Separate a Column into Multiple Rows in R: Hint tidyr’s spearate_row()
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
How to Select Rows of a dataframe by position
In this post, we will see how to subset a dataframe or select rows based on their position. We will first use dplyr's slice() function to slice a dataframe by location and then show how to select rows by position using base R Let us load tidyverse suite of R packages … [Read more...] about How to Select Rows of a dataframe by position
How to replace NA in a column with specific value
In this tutorial we will learn how to replace missing values/NA in a column with a specific value. We will replace NA in a column using two approaches. At first we will use dplyr function mutate and ifelse to identify the element(s) with NA and replace with a specific value. Next … [Read more...] about How to replace NA in a column with specific value
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