Articles by R | TypeThePipe

How to Modify Variables the Right Way in R

April 3, 2023 | R | TypeThePipe

Introduction In data analysis and data science, it’s common to work with large datasets that require some form of manipulation to be useful. In this small article, we’ll explore how to create and modify columns in a dataframe using modern R tools from the tidyverse package. We can ...
[Read more...]

How to write functions with ggplot

February 22, 2022 | R | TypeThePipe

The tidy Data Scientist As a data scientist, having the right tools in your toolbox is a must, and this is one of them. Tidyverse and dplyr verbs allow us to write clean code with the use of tidy evaluation. Tidy evaluation? Tidy evaluation is a programming paradigm in the ...
[Read more...]

Analyzing Remote Work in European Countries

June 13, 2021 | R | TypeThePipe

1. Data downloading As we always do, we are going to connect and download the desired data. In this case, our data source is the Eurostat. We download and read the data file. library(tidyverse) download.file("https://ec.europa.eu/eurostat/api/dissemination/sdmx/2.1/data/LFSA_EHOMP/?format=SDMX-CSV&compressed=...
[Read more...]

Analyzing data from COVID19 R package

May 26, 2020 | R | TypeThePipe

Introduction The idea behind this post was to play and discover some of the info contained in the COVID19 R package which collects data across several governmental sources.This package is being developed by the Guidotti and Ardia from COVID19 Data Hub. Later, I will add to the analysis the ...
[Read more...]

Calculating ratios with Tidyverse

May 12, 2020 | R | TypeThePipe

Calculating percentages is a fairly common operation, right? However, doing it without leaving the pipeflow always force me to do some bizarre piping such as double grouping and summarise. I am using again the nuclear accidents dataset, and trying to calculate the percentage of accidents that happened in Europe each ... [Read more...]

Preserving zero-length groups

May 8, 2020 | R | TypeThePipe

This week I learned about another neat trick with tidyverse functions: the argument .drop from the group_by function. To showcase this functionality I made up a simple example with this dataset consisting of nuclear accidents data. original_data % mdy() %__% year(), In_Europe = if_else(Region %in% c("EE", "WE"), ...
[Read more...]

Drop columns based on NAs percentage in R

March 22, 2020 | R | TypeThePipe

Are you developing an automated exploration tool? Here we propose some alternatives to drop columns with high percentage of NAs. In this previous tip we talk about BaseR vs Tidy & Purrr counting NAs performance. Not leaving the pipeflow. How much does it cost?;) It depends on the NA distribution between ...
[Read more...]

Tidylog

January 20, 2020 | R | TypeThePipe

Some time ago I made one of the best discoveries I have ever made in the Tidyverse: a tool called tidylog. This package is built on top of dplyr and tidyr and provides us with feedback on the results of the operations. Actually, this is a feature that already appeared ... [Read more...]

Tidylog. Logging your pipelines

January 20, 2020 | R | TypeThePipe

Some time ago I made one of the best discoveries I have ever made in the Tidyverse: a tool called tidylog. This package is built on top of dplyr and tidyr and provides us with feedback on the results of the operations. Actually, this is a feature that already appeared ... [Read more...]

Using summarise_at(). Weighted mean Tidyverse approach

January 15, 2020 | R | TypeThePipe

Supose you are analysing survey data. You are asked to get the mean in a representative way, weighting your individuals depending on the number of members of their segment. library(tidyverse) survey_data % group_by(region1, region2, gender) %__% mutate(weight = 1/n()) %__% ungroup() %__% summarise_at(vars(contains("q")), funs(weighted_mean = ... [Read more...]

Skills chart using Gplot2 with R

January 6, 2020 | R | TypeThePipe

In this TypeThePipe tip we are bringing you a skills plot template using R and ggplot2. Maybe its a good idea to evolve this plot and add an unique skill plot to your CV. And it’s only a few lines of R code! You can see the code below :) ...
[Read more...]
1 2

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)