
Exploring magrittr: Plumbing and Programming Simultaneously
Dive into the world of magrittr where plumbing and programming coexist harmoniously. Learn how each output becomes the first argument of the next input, and master the four basic operators. Copy and paste examples into your R console to enhance your data manipulation skills.
Download Presentation

Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.
E N D
Presentation Transcript
magrittr: Plumbing and Programing at the Same Time
Basics Each output becomes the first argument of the next input The dot will specify a place other than the first argument Four basic operators, will give a demo of each Yes, they can be debugged 104.196.168.117
The Examples, copy and paste them into R library(magrittr) library(babynames) library(dplyr) library(ggplot2) ## FULL DISCLOSURE, all examples from other sources! # pipe operator car_data <- mtcars %>% subset(hp > 100) %>% aggregate(. ~ cyl, data = ., FUN = . %>% mean %>% round(2)) %>% transform(kpl = mpg %>% multiply_by(0.4251)) %>% print # multiple resue car_data %>% { if (nrow(.) > 0) rbind(head(., 1), tail(., 1))
? Questions