Skip to content

Commit

Permalink
Add lab
Browse files Browse the repository at this point in the history
  • Loading branch information
clifmckee committed Jan 5, 2024
1 parent c2cd7ed commit 4b70761
Show file tree
Hide file tree
Showing 6 changed files with 979 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/_schedule_table.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
| | | | | | |
| [Day 1](docs/module_details/day1.html) | Intro | [HTML](modules/Intro/Intro.html), [PDF](modules/Intro/Intro.pdf) | [Rmd](modules/Intro/Intro.Rmd) | | [Day 1 Cheatsheet](modules/cheatsheets/Day-1.pdf) |
| | RStudio | [HTML](modules/RStudio/RStudio.html), [PDF](modules/RStudio/RStudio.pdf) | [Rmd](modules/RStudio/RStudio.Rmd) | [Lab](modules/RStudio/lab/RStudio_Lab.Rmd), [Key](modules/RStudio/lab/RStudio_Lab_Key.Rmd), [Key HTML](modules/RStudio/lab/RStudio_Lab_Key.html) | |
| | Reproducibility | [HTML](modules/Reproducibility/Reproducibility.html), [PDF](modules/Reproducibility/Reproducibility.pdf) | [Rmd](modules/Reproducibility/Reproducibility.Rmd) | | [Good scientific coding practices](resources/good-scientific-coding-practices.pdf) |
| | Reproducibility | [HTML](modules/Reproducibility/Reproducibility.html), [PDF](modules/Reproducibility/Reproducibility.pdf) | [Rmd](modules/Reproducibility/Reproducibility.Rmd) | [Lab](modules/Reproducibility/lab/Reproducibility_Lab.Rmd), [Key](modules/Reproducibility/lab/Reproducibility_Lab_Key.Rmd), [Key HTML](modules/Reproducibility/lab/Reproducibility_Lab_Key.html) | [Good scientific coding practices](resources/good-scientific-coding-practices.pdf) |
| | | | | | |
| [Day 2](docs/module_details/day2.html) | Basic R | [HTML](modules/Basic_R/Basic_R.html), [PDF](modules/Basic_R/Basic_R.pdf) | [Rmd](modules/Basic_R/Basic_R.Rmd) | [Lab](modules/Basic_R/lab/Basic_R_Lab.Rmd), [Key](modules/Basic_R/lab/Basic_R_Lab_Key.Rmd), [Key HTML](modules/Basic_R/lab/Basic_R_Lab_Key.html) | [Day 2 Cheatsheet](modules/cheatsheets/Day-2.pdf) |
| | Data Input | [HTML](modules/Data_Input/Data_Input.html), [PDF](modules/Data_Input/Data_Input.pdf) | [Rmd](modules/Data_Input/Data_Input.Rmd) | [Lab](modules/Data_Input/lab/Data_Input_Lab.Rmd), [Key](modules/Data_Input/lab/Data_Input_Lab_Key.Rmd), [Key HTML](modules/Data_Input/lab/Data_Input_Lab_Key.html) | [Debugging tips guide](resources/debugging_guide.pdf) |
Expand Down
4 changes: 4 additions & 0 deletions modules/Reproducibility/Reproducibility.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ sessionInfo()
knitr::include_graphics("images/session_info.png")
```

## Lab 1

🏠 [Class Website](https://jhudatascience.org/intro_to_r/)
💻 [Lab](https://jhudatascience.org/intro_to_r/modules/Reproducibility/lab/Reproducibility_Lab.Rmd)

## More resources

Expand Down
34 changes: 34 additions & 0 deletions modules/Reproducibility/lab/Reproducibility_Lab.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
title: "Reproducibility Lab"
output: html_document
editor_options:
chunk_output_type: console
---

1. Create two objects in your environment, `x` and `y`. Assign `x` as a vector of numbers 1, 2, and 3. Assign `y` as a vector of numbers 4, 5, and 6. Once complete, check that both objects are visible in your RStudio environment.
```{r}
```

2. Clear your environment. Check that `x` and `y` are no longer in the environment by typing each letter in the console. What is the result?
```{r}
```

3. Check your R session info. Which version of R are you running? Which version of the `knitr` package are you running? Write these details below.
```{r}
```

- R version:
- knitr version:

**Bonus / Extra practice**: Create a vector `z` with the numbers 0 to 9. Set the seed for the R random number generator to 1234. Draw 5 numbers at random from `z` using the `sample()` function with `replace = TRUE`. Repeatedly run the code 3 times and note what you observe.
```{r}
```

**Bonus / Extra practice**: Run the `sample()` statement again, but this time without running the `set.seed()` line. What do you notice about the 5 numbers?
```{r}
```
430 changes: 430 additions & 0 deletions modules/Reproducibility/lab/Reproducibility_Lab.html

Large diffs are not rendered by default.

39 changes: 39 additions & 0 deletions modules/Reproducibility/lab/Reproducibility_Lab_Key.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
title: "Reproducibility Lab Key"
output: html_document
editor_options:
chunk_output_type: console
---

1. Create two objects in your environment, `x` and `y`. Assign `x` as a vector of numbers 1, 2, and 3. Assign `y` as a vector of numbers 4, 5, and 6. Once complete, check that both objects are visible in your RStudio environment.
```{r}
x <- c(1, 2, 3)
y <- c(4, 5, 6)
x
y
```

2. Clear your environment. Check that `x` and `y` are no longer in the environment by typing each letter in the console. What is the result?
```{r}
rm(list = ls())
```

3. Check your R session info. Which version of R are you running? Which version of the `knitr` package are you running? Write these details below.
```{r}
sessionInfo()
```

- R version:
- knitr version:

**Bonus / Extra practice**: Create a vector `z` with the numbers 0 to 9. Set the seed for the R random number generator to 1234. Draw 5 numbers at random from `z` using the `sample()` function with `replace = TRUE`. Repeatedly run the code 3 times and note what you observe.
```{r}
z <- 0:9
set.seed(1234)
sample(x = z, size = 5, replace = TRUE)
```

**Bonus / Extra practice**: Run the `sample()` statement again, but this time without running the `set.seed()` line. What do you notice about the 5 numbers?
```{r}
sample(x = z, size = 5, replace = TRUE)
```
471 changes: 471 additions & 0 deletions modules/Reproducibility/lab/Reproducibility_Lab_Key.html

Large diffs are not rendered by default.

0 comments on commit 4b70761

Please sign in to comment.