Often while doing data analysis, one might create a new column or multiple columns to an existing data frame. In this post we will learn how to add one or more columns to a dataframe in R. tibble package in tidyverse, has a lesser known, but powerful function add_column(). We will learn 6 tips to […]
R
4 Tidyverse Tips for Future Self: case_when(), fct_relevel(), fct_recode(), scale_fill_brewer()
Here are four tidyverse tips for future self. These four tips/functions from tidyverse suite are a few of really simple things that I need often, but I always have to google and often struggle to come up with the search phrase. The first tip is very simple and extremely useful function case_when() from dplyr package. […]
Introduction to Canonical Correlation Analysis (CCA) in R
Canonical Correlation Analysis or CCA is a dimensionality reduction technique like Principal Component Analysis (PCA) or SVD. PCA/SVD aims to find the directions or projections that account for most of of the observed variance in a single high-dimensional data. In comparison, CCA deals with two high dimensional datasets and aims to find directions or projections […]
tidyr’s pivot_longer(): Reshape Wide Data to Long/Tidy Data
One of the most common activities while doing data analysis is to reshape data from one form to another. For human eyes and data collection, often it is easier to work with data in wider form. However, for analyzing data it is more convenient to have the data in tidy/long form in most circumstances. tidyr, […]
How To Reshape Tidy Data to Wide Data with pivot_wider() from tidyr
Reshaping the data from one for form to another is one of the most common data munging activities. tidyr, R package part of tidyverse, provides core functions to manipulate datasets in wide or long form. In this post, we will see examples of one of tidyr’s core function pivot_wider() to convert data in long tidy […]