Skip to content

Commit

Permalink
update github link
Browse files Browse the repository at this point in the history
  • Loading branch information
jmbuhr committed Oct 24, 2023
1 parent 1dee7b0 commit d83ce4b
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 69 deletions.
62 changes: 29 additions & 33 deletions 01-intro.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
aliases:
- intro.html
---

# Introduction {#intro}

::: {.alert .alert-secondary}
Expand Down Expand Up @@ -53,11 +54,11 @@ Or generate the numbers from one to 10:
```

But I rarely type directly into the console.
Because we want our results to be reproducible, we write our code in a **script** first, so that the next person [^intro-1] can see what we did and replicate our analysis.
Because we want our results to be reproducible, we write our code in a **script** first, so that the next person [^01-intro-1] can see what we did and replicate our analysis.
You will see that reproducibility is quite near and dear to me, so it will pop up once or twice.
And as scientists, I am sure you understand the importance.

[^intro-1]: This will most likely be future You.
[^01-intro-1]: This will most likely be future You.
And you will thank yourself later

> A script is like a recipe.
Expand Down Expand Up @@ -146,9 +147,9 @@ y
```

Variable names can contain letters (capitalization matters), numbers (but not as the first character) and underscores `_`.
[^intro-2]
[^01-intro-2]

[^intro-2]: They can also contain dots (`.`), but it is considered bad practice, because it can lead to some confusing edge cases.
[^01-intro-2]: They can also contain dots (`.`), but it is considered bad practice, because it can lead to some confusing edge cases.

```{r}
# snake_case
Expand Down Expand Up @@ -372,7 +373,7 @@ Sometimes it can be helpful to write our R's full name when searching (turns out

## Literate Programming with Quarto (previously Rmarkdown): Code is communication

:::aside
::: aside
[![](./images/quarto.png){width="200"}](https://quarto.org)
:::

Expand Down Expand Up @@ -605,7 +606,7 @@ Next week we will be get rid of the annoying `NA` in the legend for `sex`.
## Exercises

This course is not graded, but I need some way of confirming that you did indeed take part in this course.
In order to get the confirmation, you will send your solutions for a minimum of 5 out of the 8 exercises to me before the Seminar Fridays.
In order to get the confirmation, you will send your solutions for a minimum of 6 out of the 8 exercises to me before the Seminar Tuesdays
For each week I would like you to create a fresh quarto document with your solutions as code as well as any questions that arose during the lecture.
This will help me a lot in improving this course.

Expand All @@ -617,31 +618,32 @@ Here are today's tasks:

In a fresh quarto document (without the example template content), load the tidyverse and the palmerpenguins packages.

- Write a section of text about your **previous experience** with data analysis and/or programming (optional, but I can use this information to customize the seminars to your needs).
- Write a section of text about your **previous experience** with data analysis and/or programming (optional, but I can use this information to customize the seminars to your needs).

- Create a **vector of all odd numbers from 1 to 99** and store it in a variable.

- Create a second variable that contains the squares of the first.
- Have a look at the `tibble` function. Remember that you can always access the help page for a function using the `?` syntax, e.g. `?tibble::tibble` (The two colons `::` specify the package a function is coming from. You only need `tibble(...)` in the code because the `tibble` package is loaded automatically with the tidyverse. Here, I specify it directly to send you to the correct help page).
- Create a `tibble` where the columns are the vectors `x` and `y`.
- Create a scatterplot (points) of the two columns using `ggplot`.
- What `geom_` function do you need to add to the plot to add a line that connects your points?

- Create a **vector of all odd numbers from 1 to 99** and store it in a variable.
- Create a second variable that contains the squares of the first.
- Have a look at the `tibble` function. Remember that you can always access the help page for a function using the `?` syntax, e.g. `?tibble::tibble` (The two colons `::` specify the package a function is coming from. You only need `tibble(...)` in the code because the `tibble` package is loaded automatically with the tidyverse. Here, I specify it directly to send you to the correct help page).
- Create a `tibble` where the columns are the vectors `x` and `y`.
- Create a scatterplot (points) of the two columns using `ggplot`.
- What `geom_` function do you need to add to the plot to add a line that connects your points?
- Load the **penguins** dataset from the `palmerpenguins` package.
Produce a scatterplot of the bill length vs. the bill depth, colorcoded by species.

- Load the **penguins** dataset from the `palmerpenguins` package.
Produce a scatterplot of the bill length vs. the bill depth, colorcoded by species.
- Imaginary bonus points if you manage to use the same colors as in the [penguin-image](#fig-penguins) (hint: look at the help page for `scale_color_manual()` to find out how.
Note, that R can work with it's built-in color names, `rgb()` specifications or as hex-codes such as `#1573c7`).
Even more bonus points if you also look into the `theme()` function and it's arguments, or the `theme_<...>()` functions to make the plot prettier.
- Imaginary bonus points if you manage to use the same colors as in the [penguin-image](#fig-penguins) (hint: look at the help page for `scale_color_manual()` to find out how. Note, that R can work with it's built-in color names, `rgb()` specifications or as hex-codes such as `#1573c7`). Even more bonus points if you also look into the `theme()` function and it's arguments, or the `theme_<...>()` functions to make the plot prettier.

- Check the metadata (YAML) of your quarto document and make sure it contains your name as the `author:`.
- Check the metadata (YAML) of your quarto document and make sure it contains your name as the `author:`.

- The filename of your solution should also contain your name, e.g. `lecture1-jannik.qmd`, which gets rendered to `lecture1-jannik.html` when you knit it.
- The filename of your solution should also contain your name, e.g. `lecture1-jannik.qmd`, which gets rendered to `lecture1-jannik.html` when you knit it.

- Make the output document [self contained](https://quarto.org/docs/output-formats/html-basics.html#self-contained) by adding `embed-resources: true` to the yaml header.
- [Here](https://quarto.org/docs/reference/formats/html.html) are a couple more YAML options you can try if you feel adventurous.
- Make the output document [self contained](https://quarto.org/docs/output-formats/html-basics.html#self-contained) by adding `embed-resources: true` to the yaml header.

- [Here](https://quarto.org/docs/reference/formats/html.html) are a couple more YAML options you can try if you feel adventurous.

The top of your Quarto document should now look like this between the `---`:

```yaml
``` yaml
title: "Lecture 1"
author: <Your Name>
format:
Expand All @@ -653,17 +655,11 @@ execute:
warning: false
```
- Knit it and ship it! (=press the render button and send me the rendered html document via discord)
- Knit it and ship it! (=press the render button and send me the rendered html document via discord)
::: {.callout-caution}
- Some operating systems (looking at you, Windows), will not show you file extensions by default (e.g. `.html`, `.png`, `docx`).
[Here](https://www.howtogeek.com/205086/beginner-how-to-make-windows-show-file-extensions/) is a guide on how to turn them on in Windows 11 and 10.
I recommend to to so, to make it easier for you to send the correct file (the rendered html file instead of the source qmd).
- You can test that your file is truely self contained, by copying it to a different location on your computer and opening it (a simple double-click should suffice) with your default browser.
If you can see your plots, you are good to go.
If you don't see them that means the plots are not embedded into the output (just linked to their relative location).
Check the second-to-last point of the exercise list again.
::: callout-caution
- Some operating systems (looking at you, Windows), will not show you file extensions by default (e.g. `.html`, `.png`, `docx`). [Here](https://www.howtogeek.com/205086/beginner-how-to-make-windows-show-file-extensions/) is a guide on how to turn them on in Windows 11 and 10. I recommend to to so, to make it easier for you to send the correct file (the rendered html file instead of the source qmd).
- You can test that your file is truely self contained, by copying it to a different location on your computer and opening it (a simple double-click should suffice) with your default browser. If you can see your plots, you are good to go. If you don't see them that means the plots are not embedded into the output (just linked to their relative location). Check the second-to-last point of the exercise list again.
:::

### Exercise Tips
Expand Down
7 changes: 3 additions & 4 deletions 02-data-wrangling.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,9 @@ There is also the option to not load a package at all but rather only use one fu

Without further ado, let's download the data for today.
In fact, there are multiple ways to go about this.
We could download the whole course folder from GitHub by following the link
that says "View book source"
in the left sidebar (or the pancake-menu in mobile view) and then using the download button
on GitHub:
We could download the whole course folder from GitHub
<https://github.com/jmbuhr/dataintro>
and then using the "<> Code" download button:

![](images/download_repo.png)

Expand Down
4 changes: 2 additions & 2 deletions _freeze/01-intro/execute-results/html.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions _freeze/02-data-wrangling/execute-results/html.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/01-intro.html
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@ <h1 class="title"><span id="intro" class="quarto-section-identifier"><span class
<li><a href="https://github.com/gadenbuie/rsthemes" class="uri">https://github.com/gadenbuie/rsthemes</a></li>
</ul></section><section id="exercises" class="level2" data-number="1.14"><h2 data-number="1.14" class="anchored" data-anchor-id="exercises">
<span class="header-section-number">1.14</span> Exercises</h2>
<p>This course is not graded, but I need some way of confirming that you did indeed take part in this course. In order to get the confirmation, you will send your solutions for a minimum of 5 out of the 8 exercises to me before the Seminar Fridays. For each week I would like you to create a fresh quarto document with your solutions as code as well as any questions that arose during the lecture. This will help me a lot in improving this course.</p>
<p>This course is not graded, but I need some way of confirming that you did indeed take part in this course. In order to get the confirmation, you will send your solutions for a minimum of 6 out of the 8 exercises to me before the Seminar Tuesdays For each week I would like you to create a fresh quarto document with your solutions as code as well as any questions that arose during the lecture. This will help me a lot in improving this course.</p>
<p>When you are done solving the exercises, hit the <code>knit</code> button (at the top of the editor panel) and send me the resulting <strong>html</strong> document via discord (confirm that it looks the way you expected beforehand).</p>
<p>Here are today’s tasks:</p>
<section id="put-your-flippers-in-the-air" class="level3" data-number="1.14.1"><h3 data-number="1.14.1" class="anchored" data-anchor-id="put-your-flippers-in-the-air">
Expand Down
2 changes: 1 addition & 1 deletion docs/02-data-wrangling.html
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ <h1 class="title">
<aside><p><a href="https://readr.tidyverse.org/"> <img src="images/readr.png" class="img-fluid" alt="The readr logo"></a></p>
</aside><p>The package responsible for loading data in the tidyverse is called <code>readr</code>, so we start by loading the whole tidyverse.</p>
<p>Note, that in general, we could also load just the <code>readr</code> package with <code><a href="https://readr.tidyverse.org">library(readr)</a></code>, but we need the rest of the tidyverse later on anyways. There is also the option to not load a package at all but rather only use one function from a package by prefixing the function with the package name and two colons (<code>::</code>) Like so: <code>readr::read_csv("...")</code>.</p>
<p>Without further ado, let’s download the data for today. In fact, there are multiple ways to go about this. We could download the whole course folder from GitHub by following the link that says “View book source” in the left sidebar (or the pancake-menu in mobile view) and then using the download button on GitHub:</p>
<p>Without further ado, let’s download the data for today. In fact, there are multiple ways to go about this. We could download the whole course folder from GitHub <a href="https://github.com/jmbuhr/dataintro" class="uri">https://github.com/jmbuhr/dataintro</a> and then using the “&lt;&gt; Code” download button:</p>
<p><img src="images/download_repo.png" class="img-fluid"></p>
<p>The data is all in a folder called <code>data</code> and organized into sub-folders with the lecture number. So everything you need for today can be found in folder <code>02</code>.</p>
<p>On GitHub, we can also download individual files, but for plain text files you need to remember one extra step. If you have already clicked on the file in GitHub and can see it’s content, it is tempting to copy and paste the link from the browser bar and use R’s <code>download.file</code> function. However, this is just the link to the part of the website where GitHub shows the file, not a link to the actual file. We can get the correct link by clicking on the <strong>Raw</strong> button:</p>
Expand Down
4 changes: 2 additions & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta name="generator" content="quarto-1.3.450">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<meta name="author" content="Jannik Buhr">
<meta name="dcterms.date" content="2023-10-17">
<meta name="dcterms.date" content="2023-10-24">
<meta name="description" content="This is where you will find all the resources for the course Introduction to Data Analysis with R">
<title>Introduction to Data Analysis with R</title>
<style>
Expand Down Expand Up @@ -225,7 +225,7 @@ <h1 class="title">Introduction to Data Analysis with R</h1>
<div>
<div class="quarto-title-meta-heading">Published</div>
<div class="quarto-title-meta-contents">
<p class="date">October 17, 2023</p>
<p class="date">October 24, 2023</p>
</div>
</div>

Expand Down
Loading

0 comments on commit d83ce4b

Please sign in to comment.