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 variable in… Continue reading How To find levels of a factor in R

How to select one or more columns from a dataframe

In this tutorial we will learn how to select one or more columns/variables from a data frame in R. We first learn how to select the columns of interest with dplyr’s select() function by using their name and then we will learn how to select columns using base R approach. Let us get started by… Continue reading How to select one or more columns from a dataframe

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

Exit mobile version