• Stars
    star
    250
  • Rank 162,397 (Top 4 %)
  • Language
    R
  • License
    Other
  • Created almost 8 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A introduction to purrr

A purrr tutorial

This repo hosts the materials for a purrr tutorial. The materials currently reflect the version planned for the useR! Brussels, Belgium, July 2017.

Upcoming in-person tutorials

Older versions of the materials, from prior in-person tutorials, are also available:

Outline

Code with a lot of duplication is harder to understand, troubleshoot and maintain. The goal of this tutorial is help you remove duplication in your code by using functions that write for loops for you.

You'll learn to use the functions in the purrr package to perform iterative tasks: tasks that look like "for each _____ do _____".

By the end of the tutorial you'll be writing code that is more readable and easier to update and you'll be ready to solve new iteration problems faster and with fewer mistakes.

Learning Objectives

By the end of the tutorial, you'll be able to:

  • Move from solving a problem on a single element, to iterating that solution over many elements with map().
  • Identify when to use the typed variants of map(): map_lgl(), map_int(), walk() etc.
  • Iterate over two arguments with map2().
  • Leverage purrr to get list data into tibbles.
  • Use purrr to work with list columns in tibbles.

Pre-requisites

Don't worry if you have never written a for loop, used lapply(), written your own function or heard of a tibble, this tutorial is designed to be accessible to beginners.

That said, you should be familiar with exploring and subsetting the basic data structures in R including lists and data frames.

This is a hands-on tutorial, you'll need your laptop with R installed, as well as a few packages:

install.packages("tidyverse")

# install.packages("devtools")
devtools::install_github("jennybc/repurrrsive")

License

Creative Commons License
This purrr tutorial by Charlotte Wickham is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.

More Repositories

1

data-science-in-tidyverse

Data Science in the tidyverse, a two-day workshop @ rstudio:conf(2018)
146
star
2

munsell

munsell colour system for R
HTML
107
star
3

advanced-r

One day course covering functions, functional programming and tidy evaluation
R
42
star
4

quotation

Materials from a talk at the Eugene R Users meetup
38
star
5

r_intro_bc_stats

An Introduction to R and RStudio with the tidyverse delivered at BC Stats
TeX
35
star
6

data-science-in-tidyverse-solutions

Solutions for Data Science in the tidyverse
R
17
star
7

nass

R package for National Automotive Sampling System data
SAS
8
star
8

manuscript-template-rstudio

TeX
8
star
9

geospatial

R package for data used in the Working with Geospatial Data in R DataCamp course
R
7
star
10

human-side

Resources for talk "The Human Side of Data Science"
TeX
6
star
11

BerkeleyEarthR

R code to read BerkeleyEarth text files
R
6
star
12

genentech-build-tidy-tools

Materials for the Building Tidy Tools workshop at Genentech 2020
6
star
13

routes

R code for creating data art pieces documenting journeys
R
5
star
14

manuscript-showcase

Jupyter Notebook
4
star
15

r_intro_bc_stats_solutions

Solutions for Your Turns in the "Introduction to R with the tidyverse" course
3
star
16

beav-thesis

Quarto format for Oregon State University Theses
TeX
3
star
17

whats-new-in-quarto

HTML
2
star
18

streams

An teaching project to demonstrate dplyr::rowwise()
2
star
19

cRaggy

Code to generate 1-page summary for cRaggy graphics show-and-tell @ cascadiaRConf 2018
HTML
2
star
20

cnvs

Experimental R package to access Canvas LMS API based on gh
R
2
star
21

this-month-I-learned

JavaScript
2
star
22

wilcoxon

R
2
star
23

quarto-workshop-exercises

2
star
24

park_explorer

National Park Visit explorer app for the pluralsight course "Building Your First R Shiny App"
R
1
star
25

fifa-leagues

R
1
star
26

flights

Code for getting ontime data from BTS and into local postgreSQL database
R
1
star
27

streams-2

Teaching project with lots of repetition
1
star
28

submission-quarto-lite-r

R/QMD version of Notebooks Now! Quarto example
TeX
1
star
29

manuscript-template-jupyter

A template project for a Quarto Manuscript
Jupyter Notebook
1
star
30

manuscript-slides

CSS
1
star
31

qmd-embed

1
star
32

or-house-history

A place to put prototype visualizations
HTML
1
star
33

manuscript-template-vscode

TeX
1
star
34

oakridge

Slides and demo materials for a talk given at Oakridge National Labs
Jupyter Notebook
1
star
35

typst-greattables

1
star