Giter Site home page Giter Site logo

purrr-tutorial's Introduction

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.

purrr-tutorial's People

Contributors

cwickham avatar shntnu avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.