Skip to content
Open
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
1bc8755
Move file from master to individual branch
stephan-koenig May 30, 2020
3100f3b
Fix text formatting and add donwload link for data
stephan-koenig Sep 25, 2020
09c6fca
Apply suggestions from TA code review
stephan-koenig Oct 6, 2020
5d9bcbb
Apply suggestions from code review
cathy-y Oct 17, 2020
a6ab1b7
Apply suggestions from code review
cathy-y Oct 17, 2020
53f8905
Fixed markups for code chunks
cathy-y Oct 23, 2020
4d92829
Restructured order of sections, moved learning objectives to the begi…
cathy-y Oct 24, 2020
d5f518b
Update r_and_rstudio_basic.html
cathy-y Oct 31, 2020
4f3e598
Rewrote questions (and uploaded images to go with them)
cathy-y Oct 31, 2020
2187691
Question revisions
cathy-y Oct 31, 2020
7267170
Removed the working with data section
cathy-y Oct 31, 2020
9c8116b
Changed capitalization
cathy-y Nov 7, 2020
1d952f5
Added section on data types, amended questions
cathy-y Nov 7, 2020
88bf430
Update inst/tutorials/r_and_rstudio_basic/r_and_rstudio_basic.Rmd
cathy-y Nov 9, 2020
9c93172
Added section on vectors and data frames, covered logical operators i…
cathy-y Nov 15, 2020
64ffef4
Started the troubleshooting section
cathy-y Dec 1, 2020
5a98376
Completed getting help section
cathy-y Dec 1, 2020
493826e
Edited the troubleshooting section
cathy-y Dec 6, 2020
ee6ba8e
Added internal links
cathy-y Dec 12, 2020
a9ca887
Updated internal links
cathy-y Dec 12, 2020
51db6d0
Added review questions and drafted learning objectives
cathy-y Jan 18, 2021
6a08bd8
Add to IntroR review questions
Jan 25, 2021
6821e3b
I need to pull from Github and it won't let me do it until I commit
cathy-y Jan 26, 2021
1d3f967
Merge branch 'r-and-rstudio-intermediate' of https://github.com/EDUCE…
cathy-y Jan 26, 2021
f43b246
Drafted part of the section on writing functions
cathy-y Jan 27, 2021
ddadcbe
Fleshed out Functions and started helper functions
cathy-y Feb 2, 2021
ecba69e
Added section on transforming data
cathy-y Feb 3, 2021
3fdbbf2
Merge branch 'main' into r-and-rstudio-intermediate
cathy-y Feb 3, 2021
1d3efd3
Merge branch 'main' into r-and-rstudio-intermediate
stephan-koenig Feb 3, 2021
0b4e881
Added sapply section
cathy-y Feb 6, 2021
deea0d7
Added section on removing NAs
cathy-y Feb 8, 2021
e140767
Added section on tidying data
cathy-y Feb 22, 2021
948f4c4
Added questions to tidying data and started joining data
cathy-y Mar 1, 2021
61fd076
Added section on joins
cathy-y Mar 10, 2021
7d47b5d
Finished section on joins
cathy-y Mar 15, 2021
662bfd9
Merge branch 'main' into r-and-rstudio-intermediate
stephan-koenig Mar 17, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ Imports:
learnr,
readr,
shiny
RoxygenNote: 7.1.0
RoxygenNote: 7.1.1
17 changes: 17 additions & 0 deletions R/RR_installscript.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
writeLines('PATH="${RTOOLS40_HOME}\\usr\\bin;${PATH}"', con = "~/.Renviron")
if (!require(devtools)) install.packages("devtools")
remove.packages("devtools")
myPaths <- .libPaths()
myPaths <- c(myPaths[2], myPaths[1])
.libPaths(myPaths)
.libPaths()
myPaths <- .libPaths()
myPaths <- c(myPaths, "C:/CustomR")
.libPaths(myPaths)
devtools::install_github("EDUCE-UBC/educer")
1
library("dplyr")
library("learnr")
library("readr")
library("tidyverse")
install.packages("tidyverse")
Binary file added inst/resources/images/dependerror.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added inst/resources/images/mean.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added inst/resources/images/meanNA.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added inst/resources/images/objecterror.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added inst/resources/images/packageinstall.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added inst/resources/images/selecterror.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
---
title: "Intermediate R and RStudio"
author: "Cathy Yan"
date: "version `r format(Sys.time(), '%B %d, %Y')`"
output:
learnr::tutorial:
progressive: true
allow_skip: true
runtime: shiny_prerendered
description: [DESCRIPTION]
---

```{r setup, include = FALSE}
# General learnr setup
library(learnr)
knitr::opts_chunk$set(echo = TRUE)
library(educer)
# Helper function to set path to images to "/images" etc.
setup_resources()

# Tutorial specific setup
library(dplyr)
library(readr)
library(tidyverse)
```

## Learning objectives

Here's what you'll learn from each section of this tutorial:

Loops in R:

- Explain the mechanisms of for and while loops
- Implement for and while loops
- Recognize and understand how nested loops work

Conditionals in R:

- Write and evaluate and/or statements
- Identify the components of if/else statements
- Implement conditionals within loops

Functions in R:

- Write functions that operate on arguments
- Understand the role of helper functions
- Implement helper functions

Manipulating Data Frames:

- Implement the pipe operator
- Use the `select()`, `filter()`, and `mutate()` functions appropriately
- Operate on individual columns within a data frame
- Change the data type of columns in a data frame
- Replace NAs in a vector or data frame

Other ideas: Tidying data, joining data frames, loading in data from an external source

## Review

Before proceeding, complete the five questions below reviewing content from Introduction to R and RStudio Fundamentals. If any of the concepts seem unfamiliar, please revisit the previous tutorial.

```{r using-libraries, echo=FALSE}
quiz(question("In no particular order, which actions are required before using functions from a new package?",
answer("Install the package", correct=TRUE),
answer("Download vignettes"),
answer("Load the package", correct=TRUE),
answer("Install dependencies"))
)
```

Pull up the help page for the function `quantile()`.

```{r q-help, exercise=TRUE}
# your code here
```

```{r q-help-solution}
?quantile
```

```{r review, echo=FALSE}
quiz(
question("What types of arguments can be passed to `quantile()`?",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arguments may be difficult to follow for new users. The probs argument has a seq function that was not covered in the workshop

answer("Logical", correct=TRUE),
answer("Numeric", correct=TRUE),
answer("Logical Vector"),
answer("Numeric Vector", correct=TRUE),
answer("Text"))
)
```

Create a vector with the numbers 9, 27, 15, 74, 36, 4, and 49 and assign it to the variable `x`. Calculate the quantiles for `x`.

```{r q-vector, exercise=TRUE}
# your code here
```

```{r q-vector-hint-1}
x <- c(9, 27, 15, 74, 36, 4, 49)
```

```{r q-vector-solution}
x <- c(9, 27, 15, 74, 36, 4, 49)
quantile(x)
```

```{r q-type1, echo=FALSE}
quiz(
question("What is the 75% quantile for `x`?",
answer("36"),
answer("50.25"),
answer("42.5", correct=TRUE))
)
```

```{r q-type7, echo=FALSE}
quiz(
question("what is the 25% quantile for `x` if argument type = 1? ",
answer("27"),
answer("12"),
answer("15"),
answer("9", correct = TRUE))
)
```
```{r q-25, echo=FALSE}
quiz(
question("what is the 25% quantile for `x` if argument type = 7? ",
answer("27"),
answer("9"),
answer("15"),
answer("12", correct = TRUE))
)

```




Loading