rstudioconf18_jennybryan_forgot

My notes and code from "What they forgot to teach you in R" - Training Days by Jenny Bryan

This project is maintained by jminnier

Notes - Things They Forgot to Teach You In R, rstudio::conf18

Jessica Minnier 1/31/2018 and 2/1/2018

Thanks to the excellent contributions (via pull request!) from classmate Peter Higgins!

Links:

Materials: rstd.io/forgot

To use “in building” mirror: options(repos = c(CRAN = "https://cran.rstudio.com/"))

Random thoughts

Day 1: Morning - library exploration

Day 1: Mid-morning - file copying and naming, projects

Side note from my own issues in moving this repo to github

How to add an existing Rstudio repo to github:

This has changed since git 2.9, now when you add remote and then pull you need a special option. This only needs to happen if you added a Readme. Just don’t do this and life will be easier.

git remote add origin https://github.com/jminnier/rstudioconf18_jennybryan_forgot.git
git pull origin master --allow-unrelated-histories

Most easy option from happywithgitr

usethis::use_github()

Day 1: Afternoon - git/github

Day 1: Afternoon after break

knitr::opts_chunk$set(
          collapse = TRUE,
          comment = "#>",
          out.width = "100%"
)

Day 2 Morning - Jim Hester, searching github

library(lookup)
lookup(knitr::knit)

Day 2 morning, JB start up files

Day 2 Morning after break - github project example

library(here)
here()
here("day1_s1_explore-libraries")
cat(readLines(here("day1_s2_copy-files/","00_filesystem-practice_comfy.R")))

Day 2 Afternoon - make-like, live purrr coding, API example

library(repurrrsive)
tibble(
  name = map_chr(got_chars, "name"),
  titles = map(got_chars, "titles")
) %>% head
#> # A tibble: 6 x 2
#>   name              titles   
#>   <chr>             <list>   
#> 1 Theon Greyjoy     <chr [3]>
#> 2 Tyrion Lannister  <chr [2]>
#> 3 Victarion Greyjoy <chr [2]>
#> 4 Will              <chr [1]>
#> 5 Areo Hotah        <chr [1]>
#> 6 Chett             <chr [1]>

Day 2 afternoon - choose your own adventure

fig_files <- c(
"https://github.com/jennybc/orly-full-res/blob/master/changinstuff-big.png",
"https://github.com/jennybc/orly-full-res/blob/master/uninformativegitcommit-big.png")
fig_files_smaller <- gsub("(^.*)(\\.png$)", "\\1-smaller\\2", fig_files)

tags <- sprintf("<a href=\"%s\"><img src=\"%s\"></a>",
                fig_files, fig_files_smaller)
cat(tags)
#> <a href="https://github.com/jennybc/orly-full-res/blob/master/changinstuff-big.png"><img src="https://github.com/jennybc/orly-full-res/blob/master/changinstuff-big-smaller.png"></a> <a href="https://github.com/jennybc/orly-full-res/blob/master/uninformativegitcommit-big.png"><img src="https://github.com/jennybc/orly-full-res/blob/master/uninformativegitcommit-big-smaller.png"></a>
url <- "https://raw.githubusercontent.com/jennybc/fattest-cat/master/fattest-cat.R"
rfile <- basename(url)
download.file(url, rfile)
source(rfile)

Q’s