In this tutorial, we will learn how to select columns that ends with a string with multiple examples using dplyr and base R. With dplyr, we can use ends_with(), one of the select helper functions, to select columns that ends with a prefix/string. Similarly, in base R we have … [Read more...] about dplyr ends_with(): select columns that end with a suffix
How to collapse multiple rows based on a column
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
How to Separate a Column into Multiple Rows in R: Hint tidyr’s spearate_row()
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