class: center, middle, inverse, title-slide .title[ # Loops and conditionals ] .author[ ### Lars Relund Nielsen ] --- layout: true --- ## Comparison/relational operators - `<` for less than, `>` for greater than, - `<=` for less than or equal to, `>=` for greater than or equal to, - `==` for equal to each other (and not `=` which is typically used for assignment!), - `!=` not equal to each other. ```r x <- TRUE # you may use x <- T y <- FALSE # you may use y <- F x == y ``` -- ``` ## [1] FALSE ``` -- ```r z <- c(1, -1, 3) z > 0 # vector comparison ``` -- ``` ## [1] TRUE FALSE TRUE ``` --- ## A vector of booleans ```r z <- c(1, -1, 3) z > 0 all(z > 0) any(z > 0) ``` -- ``` ## [1] TRUE FALSE TRUE ``` ``` ## [1] FALSE ``` ``` ## [1] TRUE ``` -- .your-turn[ Your turn - Try to guess the output ```r x <- c(1, 2, 45, NA, -1) x > 0 x > -100 any(x > 0) all(x > -100) ``` ]
−
+
01
:
00
--- ## Logical operators - `&` and, - `|` or, - `!` not. ```r x <- 4 y <- "Lars" z <- NA x == 4 & y == "lars" ``` ``` ## [1] FALSE ``` -- ```r x > 4 | y != "lars" ``` -- ``` ## [1] TRUE ``` --- Remember parenthesis ```r (x == 4 | y != "Lars") & !is.na(z) x == 4 | (y != "Lars" & !is.na(z)) ``` -- ``` ## [1] FALSE ``` ``` ## [1] TRUE ``` -- Logical operators applied to vectors ```r v1 <- 1:4 v2 <- c(2,-1,7,9) v1 > 1 & v2 < 3 ``` ``` ## [1] FALSE TRUE FALSE FALSE ``` --- ## Conditional Statements (a single boolean) Use of `if` and `while` (a single boolean) ```r x <- 5 if (x < 3) { cat("first") } else if (x > 4) { cat("next") } else { cat("last") } ``` ``` ## next ``` ```r x <- 1 while(x < 5) { x <- x + 1 } ``` --- ## Conditional Statements (vector of booleans) Use of `if_else` (a vectorized alternative) .midi[ .pull-left[ ```r library(tidyverse) x <- c(-5:5, NA) ## using if and for res <- rep("", length(x)) res ``` ``` ## [1] "" "" "" "" "" "" "" "" "" "" "" "" ``` ```r for (i in 1:length(x)) { if (is.na(x[i])) res[i] <- "missing" else if (x[i] < 0) res[i] <- "negative" else res[i] <- "positive" } res ``` ``` ## [1] "negative" "negative" "negative" ## [4] "negative" "negative" "positive" ## [7] "positive" "positive" "positive" ## [10] "positive" "positive" "missing" ``` ] .pull-right[ ```r ## using if_else res <- if_else(x < 0, "negative (true)", "positive (false)", "missing (na)") res ``` ``` ## [1] "negative (true)" "negative (true)" ## [3] "negative (true)" "negative (true)" ## [5] "negative (true)" "positive (false)" ## [7] "positive (false)" "positive (false)" ## [9] "positive (false)" "positive (false)" ## [11] "positive (false)" "missing (na)" ``` ] ] --- ## Loops (`for` or `while`) ```r v <- c(2,4,9,0) # values we want to iterate over res <- rep(NA, length(v)) # vector to store results in for (idx in 1:length(v)) { res[idx] <- 6 * v[idx] + 9 } res # equal 6*v + 9 ``` ``` ## [1] 21 33 63 9 ``` ```r x <- 1; res <- x while(x < 5) { x <- x + 1 res <- res + x } res # equal sum(1:5) ``` ``` ## [1] 15 ``` --- ## Use a vectorized alternative Loops in R may be slow. However, not if you follow some golden rules: * Do not use a loop when a vectorized alternative exists. * Do not grow objects (via `c`, `cbind`, etc) during the loop - R has to create a new object and copy across the information just to add a new element or row/column. Instead, allocate an object to hold the results and fill it in during the loop. ```r 6 * v + 9 ``` ``` ## [1] 21 33 63 9 ``` ```r sum(1:5) ``` ``` ## [1] 15 ``` --- ## Nested loops ```r for (i in 1:3) { for (j in 1:2) { # code here } } ``` You can replace nested loops with a single loop by using `expand_grid`: ```r library(tidyverse) ite <- expand_grid(i = 1:3, j = 1:2) for (r in 1:nrow(ite)) { # iterate over rows i <- ite$i[r] j <- ite$j[r] # code here } ``` This way of looping is a more flexible approach since you can nest more loops by adding more columns to `ite` and add different values in each column. --- ## Your Turn .your-turn[ - Given a dice and a 52-card deck, use a for loop to write all the possible combinations as strings in the form `Dice = [value] and card = [value]`. Hint (fill the missing): ```r dice <- 1:6 card_suit <- c("clubs", "diamonds", "hearts", "spades") card_number <- c("ace", 2:10, "jack", "queen", "king") ite <- expand_grid(Dice = dice, Card_suit = ___, ___) for (r in 1:nrow(ite)) { # iterate over rows cat("Dice = ", ___, " and card = ", ___, " (", ___, ").\n", sep="") } ``` ]
−
+
05
:
00
??? ```r library(tidyverse) dice <- 1:6 card_suit <- c("clubs", "diamonds", "hearts", "spades") card_number <- c("ace", 2:10, "jack", "queen", "king") dat <- expand_grid(Dice = dice, Card_suit = card_suit, Card_number = card_number) for (r in 1:nrow(dat)) { cat("Dice = ", dat$Dice[r], " and card = ", dat$Card_number[r], " (", dat$Card_suit[r], ").\n", sep="") } ``` ``` ## Dice = 1 and card = ace (clubs). ## Dice = 1 and card = 2 (clubs). ## Dice = 1 and card = 3 (clubs). ## Dice = 1 and card = 4 (clubs). ## Dice = 1 and card = 5 (clubs). ## Dice = 1 and card = 6 (clubs). ## Dice = 1 and card = 7 (clubs). ## Dice = 1 and card = 8 (clubs). ## Dice = 1 and card = 9 (clubs). ## Dice = 1 and card = 10 (clubs). ## Dice = 1 and card = jack (clubs). ## Dice = 1 and card = queen (clubs). ## Dice = 1 and card = king (clubs). ## Dice = 1 and card = ace (diamonds). ## Dice = 1 and card = 2 (diamonds). ## Dice = 1 and card = 3 (diamonds). ## Dice = 1 and card = 4 (diamonds). ## Dice = 1 and card = 5 (diamonds). ## Dice = 1 and card = 6 (diamonds). ## Dice = 1 and card = 7 (diamonds). ## Dice = 1 and card = 8 (diamonds). ## Dice = 1 and card = 9 (diamonds). ## Dice = 1 and card = 10 (diamonds). ## Dice = 1 and card = jack (diamonds). ## Dice = 1 and card = queen (diamonds). ## Dice = 1 and card = king (diamonds). ## Dice = 1 and card = ace (hearts). ## Dice = 1 and card = 2 (hearts). ## Dice = 1 and card = 3 (hearts). ## Dice = 1 and card = 4 (hearts). ## Dice = 1 and card = 5 (hearts). ## Dice = 1 and card = 6 (hearts). ## Dice = 1 and card = 7 (hearts). ## Dice = 1 and card = 8 (hearts). ## Dice = 1 and card = 9 (hearts). ## Dice = 1 and card = 10 (hearts). ## Dice = 1 and card = jack (hearts). ## Dice = 1 and card = queen (hearts). ## Dice = 1 and card = king (hearts). ## Dice = 1 and card = ace (spades). ## Dice = 1 and card = 2 (spades). ## Dice = 1 and card = 3 (spades). ## Dice = 1 and card = 4 (spades). ## Dice = 1 and card = 5 (spades). ## Dice = 1 and card = 6 (spades). ## Dice = 1 and card = 7 (spades). ## Dice = 1 and card = 8 (spades). ## Dice = 1 and card = 9 (spades). ## Dice = 1 and card = 10 (spades). ## Dice = 1 and card = jack (spades). ## Dice = 1 and card = queen (spades). ## Dice = 1 and card = king (spades). ## Dice = 2 and card = ace (clubs). ## Dice = 2 and card = 2 (clubs). ## Dice = 2 and card = 3 (clubs). ## Dice = 2 and card = 4 (clubs). ## Dice = 2 and card = 5 (clubs). ## Dice = 2 and card = 6 (clubs). ## Dice = 2 and card = 7 (clubs). ## Dice = 2 and card = 8 (clubs). ## Dice = 2 and card = 9 (clubs). ## Dice = 2 and card = 10 (clubs). ## Dice = 2 and card = jack (clubs). ## Dice = 2 and card = queen (clubs). ## Dice = 2 and card = king (clubs). ## Dice = 2 and card = ace (diamonds). ## Dice = 2 and card = 2 (diamonds). ## Dice = 2 and card = 3 (diamonds). ## Dice = 2 and card = 4 (diamonds). ## Dice = 2 and card = 5 (diamonds). ## Dice = 2 and card = 6 (diamonds). ## Dice = 2 and card = 7 (diamonds). ## Dice = 2 and card = 8 (diamonds). ## Dice = 2 and card = 9 (diamonds). ## Dice = 2 and card = 10 (diamonds). ## Dice = 2 and card = jack (diamonds). ## Dice = 2 and card = queen (diamonds). ## Dice = 2 and card = king (diamonds). ## Dice = 2 and card = ace (hearts). ## Dice = 2 and card = 2 (hearts). ## Dice = 2 and card = 3 (hearts). ## Dice = 2 and card = 4 (hearts). ## Dice = 2 and card = 5 (hearts). ## Dice = 2 and card = 6 (hearts). ## Dice = 2 and card = 7 (hearts). ## Dice = 2 and card = 8 (hearts). ## Dice = 2 and card = 9 (hearts). ## Dice = 2 and card = 10 (hearts). ## Dice = 2 and card = jack (hearts). ## Dice = 2 and card = queen (hearts). ## Dice = 2 and card = king (hearts). ## Dice = 2 and card = ace (spades). ## Dice = 2 and card = 2 (spades). ## Dice = 2 and card = 3 (spades). ## Dice = 2 and card = 4 (spades). ## Dice = 2 and card = 5 (spades). ## Dice = 2 and card = 6 (spades). ## Dice = 2 and card = 7 (spades). ## Dice = 2 and card = 8 (spades). ## Dice = 2 and card = 9 (spades). ## Dice = 2 and card = 10 (spades). ## Dice = 2 and card = jack (spades). ## Dice = 2 and card = queen (spades). ## Dice = 2 and card = king (spades). ## Dice = 3 and card = ace (clubs). ## Dice = 3 and card = 2 (clubs). ## Dice = 3 and card = 3 (clubs). ## Dice = 3 and card = 4 (clubs). ## Dice = 3 and card = 5 (clubs). ## Dice = 3 and card = 6 (clubs). ## Dice = 3 and card = 7 (clubs). ## Dice = 3 and card = 8 (clubs). ## Dice = 3 and card = 9 (clubs). ## Dice = 3 and card = 10 (clubs). ## Dice = 3 and card = jack (clubs). ## Dice = 3 and card = queen (clubs). ## Dice = 3 and card = king (clubs). ## Dice = 3 and card = ace (diamonds). ## Dice = 3 and card = 2 (diamonds). ## Dice = 3 and card = 3 (diamonds). ## Dice = 3 and card = 4 (diamonds). ## Dice = 3 and card = 5 (diamonds). ## Dice = 3 and card = 6 (diamonds). ## Dice = 3 and card = 7 (diamonds). ## Dice = 3 and card = 8 (diamonds). ## Dice = 3 and card = 9 (diamonds). ## Dice = 3 and card = 10 (diamonds). ## Dice = 3 and card = jack (diamonds). ## Dice = 3 and card = queen (diamonds). ## Dice = 3 and card = king (diamonds). ## Dice = 3 and card = ace (hearts). ## Dice = 3 and card = 2 (hearts). ## Dice = 3 and card = 3 (hearts). ## Dice = 3 and card = 4 (hearts). ## Dice = 3 and card = 5 (hearts). ## Dice = 3 and card = 6 (hearts). ## Dice = 3 and card = 7 (hearts). ## Dice = 3 and card = 8 (hearts). ## Dice = 3 and card = 9 (hearts). ## Dice = 3 and card = 10 (hearts). ## Dice = 3 and card = jack (hearts). ## Dice = 3 and card = queen (hearts). ## Dice = 3 and card = king (hearts). ## Dice = 3 and card = ace (spades). ## Dice = 3 and card = 2 (spades). ## Dice = 3 and card = 3 (spades). ## Dice = 3 and card = 4 (spades). ## Dice = 3 and card = 5 (spades). ## Dice = 3 and card = 6 (spades). ## Dice = 3 and card = 7 (spades). ## Dice = 3 and card = 8 (spades). ## Dice = 3 and card = 9 (spades). ## Dice = 3 and card = 10 (spades). ## Dice = 3 and card = jack (spades). ## Dice = 3 and card = queen (spades). ## Dice = 3 and card = king (spades). ## Dice = 4 and card = ace (clubs). ## Dice = 4 and card = 2 (clubs). ## Dice = 4 and card = 3 (clubs). ## Dice = 4 and card = 4 (clubs). ## Dice = 4 and card = 5 (clubs). ## Dice = 4 and card = 6 (clubs). ## Dice = 4 and card = 7 (clubs). ## Dice = 4 and card = 8 (clubs). ## Dice = 4 and card = 9 (clubs). ## Dice = 4 and card = 10 (clubs). ## Dice = 4 and card = jack (clubs). ## Dice = 4 and card = queen (clubs). ## Dice = 4 and card = king (clubs). ## Dice = 4 and card = ace (diamonds). ## Dice = 4 and card = 2 (diamonds). ## Dice = 4 and card = 3 (diamonds). ## Dice = 4 and card = 4 (diamonds). ## Dice = 4 and card = 5 (diamonds). ## Dice = 4 and card = 6 (diamonds). ## Dice = 4 and card = 7 (diamonds). ## Dice = 4 and card = 8 (diamonds). ## Dice = 4 and card = 9 (diamonds). ## Dice = 4 and card = 10 (diamonds). ## Dice = 4 and card = jack (diamonds). ## Dice = 4 and card = queen (diamonds). ## Dice = 4 and card = king (diamonds). ## Dice = 4 and card = ace (hearts). ## Dice = 4 and card = 2 (hearts). ## Dice = 4 and card = 3 (hearts). ## Dice = 4 and card = 4 (hearts). ## Dice = 4 and card = 5 (hearts). ## Dice = 4 and card = 6 (hearts). ## Dice = 4 and card = 7 (hearts). ## Dice = 4 and card = 8 (hearts). ## Dice = 4 and card = 9 (hearts). ## Dice = 4 and card = 10 (hearts). ## Dice = 4 and card = jack (hearts). ## Dice = 4 and card = queen (hearts). ## Dice = 4 and card = king (hearts). ## Dice = 4 and card = ace (spades). ## Dice = 4 and card = 2 (spades). ## Dice = 4 and card = 3 (spades). ## Dice = 4 and card = 4 (spades). ## Dice = 4 and card = 5 (spades). ## Dice = 4 and card = 6 (spades). ## Dice = 4 and card = 7 (spades). ## Dice = 4 and card = 8 (spades). ## Dice = 4 and card = 9 (spades). ## Dice = 4 and card = 10 (spades). ## Dice = 4 and card = jack (spades). ## Dice = 4 and card = queen (spades). ## Dice = 4 and card = king (spades). ## Dice = 5 and card = ace (clubs). ## Dice = 5 and card = 2 (clubs). ## Dice = 5 and card = 3 (clubs). ## Dice = 5 and card = 4 (clubs). ## Dice = 5 and card = 5 (clubs). ## Dice = 5 and card = 6 (clubs). ## Dice = 5 and card = 7 (clubs). ## Dice = 5 and card = 8 (clubs). ## Dice = 5 and card = 9 (clubs). ## Dice = 5 and card = 10 (clubs). ## Dice = 5 and card = jack (clubs). ## Dice = 5 and card = queen (clubs). ## Dice = 5 and card = king (clubs). ## Dice = 5 and card = ace (diamonds). ## Dice = 5 and card = 2 (diamonds). ## Dice = 5 and card = 3 (diamonds). ## Dice = 5 and card = 4 (diamonds). ## Dice = 5 and card = 5 (diamonds). ## Dice = 5 and card = 6 (diamonds). ## Dice = 5 and card = 7 (diamonds). ## Dice = 5 and card = 8 (diamonds). ## Dice = 5 and card = 9 (diamonds). ## Dice = 5 and card = 10 (diamonds). ## Dice = 5 and card = jack (diamonds). ## Dice = 5 and card = queen (diamonds). ## Dice = 5 and card = king (diamonds). ## Dice = 5 and card = ace (hearts). ## Dice = 5 and card = 2 (hearts). ## Dice = 5 and card = 3 (hearts). ## Dice = 5 and card = 4 (hearts). ## Dice = 5 and card = 5 (hearts). ## Dice = 5 and card = 6 (hearts). ## Dice = 5 and card = 7 (hearts). ## Dice = 5 and card = 8 (hearts). ## Dice = 5 and card = 9 (hearts). ## Dice = 5 and card = 10 (hearts). ## Dice = 5 and card = jack (hearts). ## Dice = 5 and card = queen (hearts). ## Dice = 5 and card = king (hearts). ## Dice = 5 and card = ace (spades). ## Dice = 5 and card = 2 (spades). ## Dice = 5 and card = 3 (spades). ## Dice = 5 and card = 4 (spades). ## Dice = 5 and card = 5 (spades). ## Dice = 5 and card = 6 (spades). ## Dice = 5 and card = 7 (spades). ## Dice = 5 and card = 8 (spades). ## Dice = 5 and card = 9 (spades). ## Dice = 5 and card = 10 (spades). ## Dice = 5 and card = jack (spades). ## Dice = 5 and card = queen (spades). ## Dice = 5 and card = king (spades). ## Dice = 6 and card = ace (clubs). ## Dice = 6 and card = 2 (clubs). ## Dice = 6 and card = 3 (clubs). ## Dice = 6 and card = 4 (clubs). ## Dice = 6 and card = 5 (clubs). ## Dice = 6 and card = 6 (clubs). ## Dice = 6 and card = 7 (clubs). ## Dice = 6 and card = 8 (clubs). ## Dice = 6 and card = 9 (clubs). ## Dice = 6 and card = 10 (clubs). ## Dice = 6 and card = jack (clubs). ## Dice = 6 and card = queen (clubs). ## Dice = 6 and card = king (clubs). ## Dice = 6 and card = ace (diamonds). ## Dice = 6 and card = 2 (diamonds). ## Dice = 6 and card = 3 (diamonds). ## Dice = 6 and card = 4 (diamonds). ## Dice = 6 and card = 5 (diamonds). ## Dice = 6 and card = 6 (diamonds). ## Dice = 6 and card = 7 (diamonds). ## Dice = 6 and card = 8 (diamonds). ## Dice = 6 and card = 9 (diamonds). ## Dice = 6 and card = 10 (diamonds). ## Dice = 6 and card = jack (diamonds). ## Dice = 6 and card = queen (diamonds). ## Dice = 6 and card = king (diamonds). ## Dice = 6 and card = ace (hearts). ## Dice = 6 and card = 2 (hearts). ## Dice = 6 and card = 3 (hearts). ## Dice = 6 and card = 4 (hearts). ## Dice = 6 and card = 5 (hearts). ## Dice = 6 and card = 6 (hearts). ## Dice = 6 and card = 7 (hearts). ## Dice = 6 and card = 8 (hearts). ## Dice = 6 and card = 9 (hearts). ## Dice = 6 and card = 10 (hearts). ## Dice = 6 and card = jack (hearts). ## Dice = 6 and card = queen (hearts). ## Dice = 6 and card = king (hearts). ## Dice = 6 and card = ace (spades). ## Dice = 6 and card = 2 (spades). ## Dice = 6 and card = 3 (spades). ## Dice = 6 and card = 4 (spades). ## Dice = 6 and card = 5 (spades). ## Dice = 6 and card = 6 (spades). ## Dice = 6 and card = 7 (spades). ## Dice = 6 and card = 8 (spades). ## Dice = 6 and card = 9 (spades). ## Dice = 6 and card = 10 (spades). ## Dice = 6 and card = jack (spades). ## Dice = 6 and card = queen (spades). ## Dice = 6 and card = king (spades). ``` [BSS]: https://bss.au.dk/en/ [course-help]: https://github.com/bss-osca/tfa/issues [cran]: https://cloud.r-project.org [cheatsheet-readr]: https://rawgit.com/rstudio/cheatsheets/master/data-import.pdf [course-welcome-to-the-tidyverse]: https://github.com/rstudio-education/welcome-to-the-tidyverse [DataCamp]: https://www.datacamp.com/ [datacamp-signup]: https://www.datacamp.com/groups/shared_links/7a7a4ede68772eefe3a53ce01aead09b538efdf6770fd59911afc29ae396b88e [datacamp-r-intro]: https://learn.datacamp.com/courses/free-introduction-to-r [datacamp-r-rmarkdown]: https://campus.datacamp.com/courses/reporting-with-rmarkdown [datacamp-r-communicating]: https://learn.datacamp.com/courses/communicating-with-data-in-the-tidyverse [datacamp-r-communicating-chap3]: https://campus.datacamp.com/courses/communicating-with-data-in-the-tidyverse/introduction-to-rmarkdown [datacamp-r-communicating-chap4]: https://campus.datacamp.com/courses/communicating-with-data-in-the-tidyverse/customizing-your-rmarkdown-report [datacamp-r-intermediate]: https://learn.datacamp.com/courses/intermediate-r [datacamp-r-intermediate-chap1]: https://campus.datacamp.com/courses/intermediate-r/chapter-1-conditionals-and-control-flow [datacamp-r-intermediate-chap2]: https://campus.datacamp.com/courses/intermediate-r/chapter-2-loops [datacamp-r-intermediate-chap3]: https://campus.datacamp.com/courses/intermediate-r/chapter-3-functions [datacamp-r-intermediate-chap4]: https://campus.datacamp.com/courses/intermediate-r/chapter-4-the-apply-family [datacamp-r-functions]: https://learn.datacamp.com/courses/introduction-to-writing-functions-in-r [datacamp-r-tidyverse]: https://learn.datacamp.com/courses/introduction-to-the-tidyverse [datacamp-r-strings]: https://learn.datacamp.com/courses/string-manipulation-with-stringr-in-r [datacamp-r-dplyr]: https://learn.datacamp.com/courses/data-manipulation-with-dplyr [datacamp-r-dplyr-bakeoff]: https://learn.datacamp.com/courses/working-with-data-in-the-tidyverse [datacamp-r-ggplot2-intro]: https://learn.datacamp.com/courses/introduction-to-data-visualization-with-ggplot2 [datacamp-r-ggplot2-intermediate]: https://learn.datacamp.com/courses/intermediate-data-visualization-with-ggplot2 [dplyr-cran]: https://CRAN.R-project.org/package=dplyr [debug-in-r]: https://rstats.wtf/debugging-r-code.html [excel-vs-r]: https://www.jessesadler.com/post/excel-vs-r/ [google-form]: https://forms.gle/s39GeDGV9AzAXUo18 [google-grupper]: https://docs.google.com/spreadsheets/d/1DHxthd5AQywAU4Crb3hM9rnog2GqGQYZ2o175SQgn_0/edit?usp=sharing [GitHub]: https://github.com/ [git-install]: https://git-scm.com/downloads [github-actions]: https://github.com/features/actions [github-pages]: https://pages.github.com/ [happy-git]: https://happygitwithr.com [hg-install-git]: https://happygitwithr.com/install-git.html [hg-why]: https://happygitwithr.com/big-picture.html#big-picture [hg-github-reg]: https://happygitwithr.com/github-acct.html#github-acct [hg-git-install]: https://happygitwithr.com/install-git.html#install-git [hg-exist-github-first]: https://happygitwithr.com/existing-github-first.html [hg-exist-github-last]: https://happygitwithr.com/existing-github-last.html [hg-credential-helper]: https://happygitwithr.com/credential-caching.html [hypothes.is]: https://web.hypothes.is/ [osca-programme]: https://kandidat.au.dk/en/operationsandsupplychainanalytics/ [Peergrade]: https://peergrade.io [peergrade-signup]: https://app.peergrade.io/join [point-and-click]: https://en.wikipedia.org/wiki/Point_and_click [pkg-bookdown]: https://bookdown.org/yihui/bookdown/ [pkg-openxlsx]: https://ycphs.github.io/openxlsx/index.html [pkg-ropensci-writexl]: https://docs.ropensci.org/writexl/ [pkg-jsonlite]: https://cran.r-project.org/web/packages/jsonlite/index.html [R]: https://www.r-project.org [RStudio]: https://rstudio.com [posit-cloud]: https://posit.cloud/spaces/426101/join?access_code=GVlexpHQRCXUAiqRiC9ux_KgoAXUyilsrVtxjaB8 [r-cloud-mod7]: https://posit.cloud/spaces/426101/content/6689201 [r-cloud-mod8]: https://posit.cloud/spaces/426101/content/6689202 [r-cloud-mod9]: https://posit.cloud/spaces/426101/content/6689203 [r-cloud-mod10]: https://posit.cloud/spaces/426101/content/6689204 [r-cloud-mod11]: https://posit.cloud/spaces/426101/content/6689205 [r-cloud-mod12]: https://posit.cloud/spaces/426101/content/6689206 [r-cloud-mod13]: https://posit.cloud/spaces/426101/content/6689207 [r-cloud-mod14]: https://posit.cloud/spaces/426101/content/6689208 [r-cloud-mod15]: https://posit.cloud/spaces/426101/content/6689209 [rstudio-download]: https://rstudio.com/products/rstudio/download/#download [rstudio-customizing]: https://support.rstudio.com/hc/en-us/articles/200549016-Customizing-RStudio [rstudio-key-shortcuts]: https://support.rstudio.com/hc/en-us/articles/200711853-Keyboard-Shortcuts [rstudio-workbench]: https://www.rstudio.com/wp-content/uploads/2014/04/rstudio-workbench.png [r-markdown]: https://rmarkdown.rstudio.com/ [ropensci-writexl]: https://docs.ropensci.org/writexl/ [r4ds-pipes]: https://r4ds.had.co.nz/pipes.html [r4ds-factors]: https://r4ds.had.co.nz/factors.html [r4ds-strings]: https://r4ds.had.co.nz/strings.html [r4ds-iteration]: https://r4ds.had.co.nz/iteration.html [stat-545]: https://stat545.com [stat-545-functions-part1]: https://stat545.com/functions-part1.html [stat-545-functions-part2]: https://stat545.com/functions-part2.html [stat-545-functions-part3]: https://stat545.com/functions-part3.html [slides-welcome]: https://bss-osca.github.io/tfa/slides/00-tfa_welcome.html [slides-m1-3]: https://bss-osca.github.io/tfa/slides/01-welcome_r_part.html [slides-m4-5]: https://bss-osca.github.io/tfa/slides/02-programming.html [slides-m6-8]: https://bss-osca.github.io/tfa/slides/03-transform.html [slides-m9]: https://bss-osca.github.io/tfa/slides/04-plot.html [slides-m83]: https://bss-osca.github.io/tfa/slides/05-joins.html [tidyverse-main-page]: https://www.tidyverse.org [tidyverse-packages]: https://www.tidyverse.org/packages/ [tidyverse-core]: https://www.tidyverse.org/packages/#core-tidyverse [tidyverse-ggplot2]: https://ggplot2.tidyverse.org/ [tidyverse-dplyr]: https://dplyr.tidyverse.org/ [tidyverse-tidyr]: https://tidyr.tidyverse.org/ [tidyverse-readr]: https://readr.tidyverse.org/ [tidyverse-purrr]: https://purrr.tidyverse.org/ [tidyverse-tibble]: https://tibble.tidyverse.org/ [tidyverse-stringr]: https://stringr.tidyverse.org/ [tidyverse-forcats]: https://forcats.tidyverse.org/ [tidyverse-readxl]: https://readxl.tidyverse.org [tidyverse-googlesheets4]: https://googlesheets4.tidyverse.org/index.html [tutorial-markdown]: https://commonmark.org/help/tutorial/ [Udemy]: https://www.udemy.com/ [vba-yt-course1]: https://www.youtube.com/playlist?list=PLpOAvcoMay5S_hb2D7iKznLqJ8QG_pde0 [vba-course1-hello]: https://youtu.be/f42OniDWaIo [vba-yt-course2]: https://www.youtube.com/playlist?list=PL3A6U40JUYCi4njVx59-vaUxYkG0yRO4m [vba-course2-devel-tab]: https://youtu.be/awEOUaw9q58 [vba-course2-devel-editor]: https://youtu.be/awEOUaw9q58 [vba-course2-devel-project]: https://youtu.be/fp6PTbU7bXo [vba-course2-devel-properties]: https://youtu.be/ks2QYKAd9Xw [vba-course2-devel-hello]: https://youtu.be/EQ6tDWBc8G4 [video-install]: https://vimeo.com/415501284 [video-rstudio-intro]: https://vimeo.com/416391353 [video-packages]: https://vimeo.com/416743698 [video-projects]: https://vimeo.com/319318233 [video-r-intro-p1]: https://www.youtube.com/watch?v=vGY5i_J2c-c [video-r-intro-p2]: https://www.youtube.com/watch?v=w8_XdYI3reU [video-r-intro-p3]: https://www.youtube.com/watch?v=NuY6jY4qE7I [video-subsetting]: https://www.youtube.com/watch?v=hWbgqzsQJF0&list=PLjTlxb-wKvXPqyY3FZDO8GqIaWuEDy-Od&index=10&t=0s [video-datatypes]: https://www.youtube.com/watch?v=5AQM-yUX9zg&list=PLjTlxb-wKvXPqyY3FZDO8GqIaWuEDy-Od&index=10 [video-control-structures]: https://www.youtube.com/watch?v=s_h9ruNwI_0 [video-conditional-loops]: https://www.youtube.com/watch?v=2evtsnPaoDg [video-functions]: https://www.youtube.com/watch?v=ffPeac3BigM [video-tibble-vs-df]: https://www.youtube.com/watch?v=EBk6PnvE1R4 [video-dplyr]: https://www.youtube.com/watch?v=aywFompr1F4 [wiki-snake-case]: https://en.wikipedia.org/wiki/Snake_case [wiki-camel-case]: https://en.wikipedia.org/wiki/Camel_case [wiki-interpreted]: https://en.wikipedia.org/wiki/Interpreted_language [wiki-literate-programming]: https://en.wikipedia.org/wiki/Literate_programming [wiki-csv]: https://en.wikipedia.org/wiki/Comma-separated_values [wiki-json]: https://en.wikipedia.org/wiki/JSON