Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Data Carpentry with Tidyverse
Search
Muhammad Aswan Syahputra
May 11, 2019
0
190
Data Carpentry with Tidyverse
Meetup Algoritma X Machine Learning ID X Komunitas R Indonesia
Muhammad Aswan Syahputra
May 11, 2019
Tweet
Share
More Decks by Muhammad Aswan Syahputra
See All by Muhammad Aswan Syahputra
#DS101: understanding the basics
aswansyahputra
0
67
Extending RStudio with Git(Hub)
aswansyahputra
0
83
Data rectangling in R: a journey from JSON to CSV
aswansyahputra
0
350
Basic Git+GitHub
aswansyahputra
1
310
Let's build your first RStudio and Addins
aswansyahputra
0
140
Introduction to R +
aswansyahputra
1
310
R (+) for Data Science
aswansyahputra
0
110
R + RStudio Tips and Tricks
aswansyahputra
0
160
Blogging with R
aswansyahputra
0
100
Featured
See All Featured
Product Roadmaps are Hard
iamctodd
PRO
50
11k
How GitHub (no longer) Works
holman
312
140k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.9k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
44
9.4k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
127
18k
Why Our Code Smells
bkeepers
PRO
335
57k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
870
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
160
15k
How to Think Like a Performance Engineer
csswizardry
22
1.3k
Writing Fast Ruby
sferik
628
61k
Measuring & Analyzing Core Web Vitals
bluesmoon
5
210
Transcript
None
• Sensory Scientist @ Sensolution.ID • Trainer @ R-Academy Telkom
University and The Datanomics Institute (TDI) • Initiator of Komunitas R Indonesia • Pkgs: sensehubr, nusandata, bandungjuara, prakiraan, etc • Shinyapps: sensehub, thermostats, aquastats, bcrp, bandungjuara, etc aswansyahputra @aswansyahputra_
R Indonesia R Indonesia www.r-indonesia.id Komunitas t.me/GNURIndonesia @r_indonesia_ indo-r www.r-indonesia.id
R Indonesia www.r-indonesia.id
Know your neighbour! • Who are you? • What you
do with data? • How would you describe your experience with R?
Artwork by @allison_horst
Artwork by @allison_horst
Data Carpentry?
It’s so relatable, is it not?
None
None
“ Do not underestimate DATA PREPROCESSING
is not a single process but a thousand of little
skills and techniques “ - David Minmo
Artwork by @allison_horst The tidyverse is an opinionated collection of
R packages designed for data science. All packages share an underlying design philosophy, grammar, and data structures.
Program Import Tidy Transform Visualise Model Communicate Understand
Program Import Tidy Transform Visualise Model Communicate Understand
Artwork by @allison_horst tidyr
Artwork by @allison_horst dplyr
dplyr basic functions: • filter() selects rows based on their
values • mutate() creates new variables • select() picks columns by name • summarise() calculates summary statistics • arrange() sorts the rows dplyr basic functions: • filter() selects rows based on their values • mutate() creates new variables • select() picks columns by name • summarise() calculates summary statistics • arrange() sorts the rows Credits to Michael Toth tidyr basic functions: • gather() wide-format >> long-format • spread() long-format >> wide-format • fill() fills value based on previous entry • complete() turns implicit missing values into explicit tidyr basic functions: • gather() wide-format >> long-format • spread() long-format >> wide-format • fill() fills value based on previous entry • complete() turns implicit missing values into explicit Operators: • ! (not) • I (or) • & (and) • ==, != • <, <=, >, >= • %in% • is.na() Operators: • ! (not) • I (or) • & (and) • ==, != • <, <=, >, >= • %in% • is.na()
How can I chain?
None
1. diputar 2. dijilat 3. dicelupin 4. dimakan :D
1. putar(apa) 2. jilat(apa, berapa_kali) 3. celup(apa, ke) 4. makan(apa,
output)
a > oreo_putar ← putar(apa = “oreo”) > oreo_jilat ←
jilat(apa = oreo_putar, berapa_kali = 2) > oreo_celup ← celup(apa = oreo_jilat, ke = “susu”) > makan(apa = oreo_celup, output = “kenyang.perut”)
> oreo_putar ← putar(apa = “oreo”) > oreo_jilat ← jilat(apa
= oreo_putar, berapa_kali = 2) > oreo_celup ← celup(apa = oreo_jilat, ke = “susu”) > makan(apa = oreo_celup, output = “kenyang.perut”) a
> makan( celup( jilat( putar(apa = “oreo”), berapa_kali = 2
), ke = “susu” ), output = “kenyang.perut” ) b
function(arg1, arg2, arg3,...) arg1 %>% function(arg2, arg3,...) function(arg1, arg2, arg3,...)
arg2 %>% function(arg1, arg2=.,arg3,...) magrittr
> putar(apa = “oreo”) %>% jilat(berapa_kali = 2) %>% celup(ke
= “susu”) %>% makan(output = “kenyang.perut”) c
What to do today?
None
www.onepiece.fandom.com www.onepiece.fandom.com
Let’s get started! • Let’s write R scripts together! •
I will demonstrate and explain the use of each code • Access this presesentation at: s.id/data-carpentry- with-tidyverse
None
None
None
None
None
None
s.id/yt_aswansyahputra s.id/yt_aswansyahputra
Thanks!
[email protected]
www.aswansyahputra.com speakerdeck.com/ aswansyahputra R Indonesia www.r-indonesia.id