dplyr filter(): How to select rows with partially matching string

In this tutorial, we will learn how to select or filter rows of a dataframe with partially matching string. dplyr’s filter() function selects/filters rows based on values of one or more columns when it completely matches. However, to filter or select rows with partially matching strings in a column, we can use filter with additional… Continue reading dplyr filter(): How to select rows with partially matching string

How to filter rows in a dataframe: dplyr’s filter()

With dplyr’s filter() function, one can filter rows or subset rows from a dataframe. In this post, we will learn how to select subset of rows based on values one or more columns in a dataframe using dplyr’s filter() function. First we load tidyverse the suit of R packages. We will use world population dataset… Continue reading How to filter rows in a dataframe: dplyr’s filter()

dplyr ends_with(): select columns that end with a suffix

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 endsWith() function to help select column… Continue reading 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 create a toy dataframe with continents and countries. Our aim… Continue reading 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 columns. We will also see how to make separate_rows() function… Continue reading How to Separate a Column into Multiple Rows in R: Hint tidyr’s spearate_row()

Exit mobile version