This post is a fun exercise applying PCA (most in tidyverse framework) to stock data from S&P 500 index companies. With PCA on stock data from S&P 500, we can possibly do many interesting things, but we will focus on really simple things and try to see if PCA captures the general company trends from […]
tidyverse
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 […]
R For Data Science Book Gets tidyr 1.0.0 Friendly
R for Data Science book by Garrett Grolemund and Hadley Wickham is the best book for doing data science with tidyverse. tidyverse, the meta-package, has loads of useful packages like tidyr, dplyr, and ggplot2 to make your life as data scientist easy. Last fall, tidyr package got a big update with version 1.0.0. Until now, […]
10 Tricks for tidyverse in R
Just happened to come across this tweet about David Robinson’s talk on “Ten Tremendous Tricks for Tidyverse”. It looked like a fantastic and useful talk. These ten tricks involve tidyverse functions one may not have heard of or thought of using in a scenario. The first four tidyverse tips is about counting and summarizing, next […]
tidyr 1.0.0 is here. pivot_longer & pivot_wider replace spread & gather
tidyr version 1.0.0 is here with a lot of new changes. tidyr has been around for about five years and it has finally tidyr has reached version 1.0.0. There are four big changes in the new version of tidyr. One of the biggest changes is the new functions pivot_longer() and pivot_wider() for reshaping tabular dataserts. […]