{"id":17790471,"url":"https://github.com/cwickham/genentech-build-tidy-tools","last_synced_at":"2026-01-11T01:36:40.405Z","repository":{"id":66634251,"uuid":"288852277","full_name":"cwickham/genentech-build-tidy-tools","owner":"cwickham","description":"Materials for the Building Tidy Tools workshop at Genentech 2020 ","archived":false,"fork":false,"pushed_at":"2020-09-17T20:29:03.000Z","size":32350,"stargazers_count":6,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-07T16:35:44.863Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc-by-sa-4.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cwickham.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-19T22:39:53.000Z","updated_at":"2023-06-09T17:37:18.000Z","dependencies_parsed_at":"2023-04-09T10:02:33.943Z","dependency_job_id":null,"html_url":"https://github.com/cwickham/genentech-build-tidy-tools","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cwickham%2Fgenentech-build-tidy-tools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cwickham%2Fgenentech-build-tidy-tools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cwickham%2Fgenentech-build-tidy-tools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cwickham%2Fgenentech-build-tidy-tools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cwickham","download_url":"https://codeload.github.com/cwickham/genentech-build-tidy-tools/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246735738,"owners_count":20825301,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-27T10:43:54.263Z","updated_at":"2026-01-11T01:36:40.372Z","avatar_url":"https://github.com/cwickham.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  message = FALSE\n)\n```\n\nBuilding Tidy Tools\n================\n\n### Genentech 2020\n\nby Charlotte Wickham and Sara Altman\n\n## Important Links\n\n[Sli.do](https://app.sli.do/event/71rqfi1i) for Q\u0026A and live polls\n\n[Google Doc](https://docs.google.com/document/d/1vahqtJ2d8zoidy1jZ19w3fxEBNWXY0YSarwtuoo-rkA/edit?usp=sharing) for reporting on your breakout room progress \n\n[Archive of Q\u0026A](https://docs.google.com/document/d/1PxGsv9spATRa453Q2lboDmKA1BP0odC2vw5ipWLjqe8/edit?usp=sharing) Questions and their answers from Slido\n\n## Materials\n\nMaterials will be made available on [github](https://github.com/cwickham/genentech-build-tidy-tools). \nThe materials will evolve as the workshop approaches, so if you want to pre-download the materials, please wait until the day before the workshop.  \n\nHowever, please don't delay on [Setup][setup].  You'll want to uncover any problems in getting the required packages before our first session together.\n\n## Setup\n\n\u003c!-- Fix later to generate from content of repo like https://github.com/hadley/tidy-tools/blob/master/README.Rmd --\u003e\n\nThe most important package for Day 1 is devtools:\n```{r, eval = FALSE}\ninstall.packages(\"devtools\")\n```\nIf you've installed devtools before, \nyou should check the component packages are also up to date,\nby following any instructions under the `devtools` section in the output of:\n```{r, eval = FALSE}\ndevtools::dev_sitrep()\n```\n\n  \nTo be prepared beyond Day 1, you'll also need the following packages:\n```{r, echo = FALSE, include = FALSE}\ndeps \u003c- unique(sort(renv::dependencies()$Package))\ndeps \u003c- setdiff(deps, c(\n  \"ns\", # created during class\n  \"rmarkdown\", \"knitr\", # only needed for .Rmd\n  \"countdown\", # only needed for instructor\n  \"renv\", # only needed for this block,\n  \"gt\", # only need for this README\n  \"bizarro\", # making it \n  c(\"stats\", \"MASS\", \"datasets\"), # recommended\n  c(\"devtools\", \"roxygen2\", \"testthat\"),\n  tidyverse::tidyverse_packages(),\n  NULL\n))\ninstall \u003c- c(\n  paste0(\"install.packages(c(\", paste0(encodeString(deps, quote = '\"'), collapse = \", \"), \"))\")\n)\n```\n```{r code = install, eval = FALSE}\n```\n\n```r\n# You may also need:\ninstall.packages(c(\"ggplot2\", \"dplyr\", \"stringr\"))\n\n# And get some partial packages we'll work with later:\nusethis::create_from_github(\"skaltman/fordogs\", fork = FALSE)\nusethis::create_from_github(\"cwickham/ns\", fork = FALSE)\nusethis::create_from_github(\"cwickham/tidytest\", fork = FALSE)\n```\n\n\u003c!-- \n* When you're done, put a green post-it on your computer. \n* If you need help, put up a pink post-it.\n--\u003e\nIf you're all set, you might like to download the first set of slides.\n\n## Schedule\n\n```{r echo = FALSE}\nlibrary(tidyverse)\nday_fmt \u003c- lubridate::stamp(\"Mon Sep 14th\", order = \"amd\")\nschedule \u003c- tribble(\n  ~ day, ~ session, ~ topic, ~ instructor, \n  ~ notes, ~ desc,\n  1, 1, \"Introduction / The Whole Game\", \"Charlotte\",\n  \"[Slides](https://github.com/cwickham/genentech-build-tidy-tools/raw/master/1-intro.pdf)\",\n  \"Build a package from scratch before your first coffee break.\",\n  1, 2, \"Testing\", \"Sara\",\n  \"[Slides](https://github.com/cwickham/genentech-build-tidy-tools/raw/master/2-testing.pdf)\",\n  \"Learn a testing workflow to give you confidence \n  your code is working as intended.\",\n  2, 1, \"Documentation / Sharing\", \"Sara\",\n  \"[Slides](https://github.com/cwickham/genentech-build-tidy-tools/raw/master/3-sharing.pdf)\",\n  \"Learn how to add documentation to your package,\n  as well as how to share you package with the world.\",\n  2, 2, \"Dependencies\", \"Charlotte\",\n  \"[Notes](notes/4-dependencies.Rmd)\",\n  \"Learn how to use other packages in your own packages.\",\n  3, 1, \"Using the tidyverse in packages\", \"Charlotte\",\n  \"[Notes](notes/5-tidyverse.Rmd)\",\n  \"Explore the challenges of including tidyverse \n  packages in your own packages.\",\n  3, 2, \"Interface\", \"Sara\",\n  \"[Notes](notes/6-interface.Rmd)\",\n  \"Learn how decisions about the name and arguments\n  of your functions influence how easy they are to learn \n  and use.\",\n  4, 1, \"Interface II\", \"Charlotte\",\n  \"[Notes](notes/7-interface-ii.Rmd)\",\n  \"Learn how decisions about the output\n  of your functions influence how easy they are to learn \n  and use.\",\n  4, 2, \"OO programming / S3\", \"Charlotte\", \n  \"[Notes](notes/8-oop.Rmd)\",\n  \"Learn how S3 objects work, and can improve\n  the interface of your package.\"\n) %\u003e% \n  mutate(\n    date = (as.Date(\"2020-09-14\") + (day - 1)) %\u003e% day_fmt(),\n    desc = glue::glue(\"**{topic}**\\n \n    *{instructor}*\\n\n    {notes}\\n\n    \u003csmall\u003e{desc}\u003c/small\u003e\")\n  )\nschedule %\u003e% \n  select(date, desc, session) %\u003e% \n  pivot_wider(names_from = session, values_from = desc) %\u003e% \n  gt::gt() %\u003e% \n  gt::cols_label(`1` = \"8:30am-10:00am\", `2` = \"10:30am-12:00pm\",\n    date = \"Day\") %\u003e% \n  gt::fmt_markdown(columns = TRUE, rows = TRUE) %\u003e%  \n  gt::as_raw_html()\n```\n\nThe notes will be live coded and committed as we go, \nso they may be empty if you are looking at them before the workshop.\n\nYou can see the scripts we'll work from in [`script/`](script/), but we recommend not reading too far ahead because you'll find answers to some of the exercises, and you'll learn more if you try to work through them first.\n\n## Getting Help\n\n[**Sli.do**](https://app.sli.do/event/71rqfi1i): Ask a question in the Q\u0026A at anytime. Also vote on other peoples' questions.\n\n**In Breakout Rooms:**\n\n* Ask your roommates\n* If your room is stuck, \"Ask for help\" in the [Google Doc](https://docs.google.com/document/d/1vahqtJ2d8zoidy1jZ19w3fxEBNWXY0YSarwtuoo-rkA/edit?usp=sharing)\n\n**Zoom chat:** Reserved for urgent technical matters (e.g. \"we can't hear you\")\n\n## Where to learn more\n\n* **Workflow, devtools and usethis:**\n    * [R Packages, 2nd Ed.](https://r-pkgs.org/), *work in progress*\n    * [R Packages, 1st Ed.](http://r-pkgs.had.co.nz/)\n    \n    * [What they forgot to teach you about R](https://rstats.wtf/)\n\n* **Interface:** [Tidyverse design guide](https://design.tidyverse.org/), *work in progress*\n\n* **Implementation:**\n    \n    * Tidy evaluation:\n        \n        * [Programming with dplyr](https://dplyr.tidyverse.org/articles/programming.html)\n        * [Using ggplot2 in packages](https://ggplot2.tidyverse.org/articles/ggplot2-in-packages.html)\n        * Only if you want/need the theory: [Metaprogramming in Advanced R](https://adv-r.hadley.nz/metaprogramming.html)\n        \n    * Object Oriented Programming / S3: [Object Oriented Programming in Advanced R](https://adv-r.hadley.nz/oo.html)\n\n* General R programming:\n    * [Advanced R](https://adv-r.hadley.nz/), in particular the Foundations part\n    * [Programming notes from Data Challenge Lab](https://dcl-prog.stanford.edu/)\n\n## Overview\n\nThis is a hands on workshop for those who have embraced the tidyverse and now want to expand it to meet their own needs. We'll discuss API design, functional programming tools, the basics of object design in S3, and the tidy eval system for NSE.\n\nAt the end of the workshop participants will be able to:\n\n* Apply an efficient workflow for building R packages, \ndocumenting functions and unit testing using the usethis and devtools packages.\n\n* Implement commonly used frameworks inside packages like tidy evaluation and object oriented programming.\n\n* Critique the interface of a package and suggest improvements\nthat would make the package easier to learn and use.\n\nYou should take this workshop if you have experience programming in R and want to learn how to tackle larger scale problems. You'll get the most from it if you're already familiar with functions and are comfortable with R’s basic data structures (vectors, matrices, arrays, lists, and data frames). \n\n## Is this course for me?\n\nHave you written a few of your own R functions? Are you ready to start sharing your code (or data) through R packages? Are you curious what you can do to make your first R packages easy for your users to use, and for you to maintain?\n\n-----\n\nThese materials closely follow https://github.com/hadley/tidy-tools\n\n![](https://i.creativecommons.org/l/by/4.0/88x31.png) This work is\nlicensed under a [Creative Commons Attribution 4.0 International\nLicense](https://creativecommons.org/licenses/by/4.0/).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcwickham%2Fgenentech-build-tidy-tools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcwickham%2Fgenentech-build-tidy-tools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcwickham%2Fgenentech-build-tidy-tools/lists"}