How to select only numeric columns in a dataframe

In this tutorial, we will learn how to select the columns that are numeric from a dataframe containing columns of different datatype. We will use dplyr’s select() function in combination with where() and is.numeric() functions to select the numeric columns. Let us first load tidyverse and palmer penguin datasets to illustrate selecting numerical variables. select()… Continue reading How to select only numeric columns in a dataframe

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() function to do the… Continue reading How to Split a Dataframe into a list of Dataframes by groups in R

How to sum a column by group in R

How to sum a column by group in R

In this tutorial, we will learn how to compute the sum of a column by groups in another column in a dataframe. Basic, idea is to group the dataframe by the grouping variable/column and then find the sum for each group. Let us get started by loading tidyverse suite of R packages. We will be… Continue reading How to sum a column by group in R

How to extract a column of a dataframe as a vector in R

Extract A Column As Vector in R

In this tutorial, we will learn how to extract a column from a dataframe in R. We will extract a column as a vector using base R method and then see multiple examples of using dplyr’s pull() function to extract a column from a dataframe. Getting Ready with Packages and Data Let us get started… Continue reading How to extract a column of a dataframe as a vector in R

Exit mobile version