How to drop unused level of factor variable in R

In this post, we will learn how to drop unused level or levels of a factor variable in R. Sometimes, we may end up with a factor variable with un used levels after some data munging. Unused factor levels can sometime create issues while analyzing the data. In this tutorial, we will show how to… Continue reading How to drop unused level of factor variable in R

How to convert a list to a dataframe

In this tutorial, we will learn 3 different ways to convert a list object into a dataframe in R. First we will show how to use the base R function as.data.frame() to convert a list to a dataframe. Then we will show examples using map_df() function in purrr package in tidyverse and bind_rows() function in… Continue reading How to convert a list to a dataframe

How to add currency symbols to columns of a table with gt()

In this tutorial, we will learn how to add currency symbols, like US dollars, Euro, UK pound, Indian Rupee to columns of a table using the R package gt. Let us load gt package to make beautiful tables and tidyverse. First we will create a simple dataframe/tibble with stock prices of a few companies in… Continue reading How to add currency symbols to columns of a table with gt()

Exit mobile version