How to remove columns with all NAs

Remove columns with all NAs

In this tutorial, we will learn how to drop columns with values that are all NAs. We will use two approaches to remove columns with all NAs. First, we will use tidyverse approach, where we perform column-wise operation to see all values are NAs and select columns that are not all NAs. Next we will… Continue reading How to remove columns with all NAs

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

Exit mobile version