Skip to content

Commit 68ffe47

Browse files
Merge pull request #52 from UtrechtUniversity/dorien-changes
Small fixes, move R project slide to morning session
2 parents 2a37fd3 + 8d19e9b commit 68ffe47

File tree

4 files changed

+21
-41
lines changed

4 files changed

+21
-41
lines changed

book/index.qmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ your work.
1717

1818
Our workshop material is licensed under a Creative Commons Attribution 4.0
1919
International License. You can view the license
20-
[in our GitHub repository](https://github.com/UtrechtUniversity/workshop-introduction-to-R-and-data/blob/main/LICENSE.md).
20+
[in our GitHub repository](https://github.com/UtrechtUniversity/workshop-introduction-to-R-and-data/blob/main/LICENSE).

book/slides/slides_introduction.qmd

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,25 @@ Part 1: Basics of R
9292

9393
5. From the ‘Files’ menu (bottom right), click **baseR_exercises.Rmd**.
9494

95+
## R project files
96+
97+
When you start programming for yourself:
98+
99+
- Create a folder dedicated to your project
100+
- Start a new R project: **File > New Project > Existing Directory**
101+
- An `.RProj` file will be created
102+
103+
. . .
104+
105+
Advantages:
106+
107+
- Automatically set your working directory to that folder
108+
- Automatically retrieve only the history and objects from that R project
109+
- More reproducible (relative vs. absolute paths)
110+
111+
```r
112+
getwd()
113+
```
95114

96115
## Running R code
97116

book/slides/slides_tidyverse.qmd

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -56,43 +56,6 @@ dplyr::rename(iris, petal_length = Petal.Length)
5656

5757
# Go to Exercise 0 in `datascience_exercises.Rmd`
5858

59-
# Some good coding practices {background-color=#FFCD00}
60-
61-
## R projects and working directories
62-
63-
When you start programming for yourself:
64-
65-
- Create a folder dedicated to your project
66-
- Start a new R project: **File > New Project > Existing Directory**
67-
- An `.RProj` file will be created
68-
69-
. . .
70-
71-
Advantages:
72-
73-
- Automatically set your working directory to that folder
74-
- Automatically retrieve only the history and objects from that R project
75-
- More reproducible (relative vs. absolute paths)
76-
77-
```r
78-
getwd()
79-
```
80-
81-
## Comments
82-
83-
If a line of R code starts with `#`, it is ignored.
84-
85-
- Help your future you and collaborators/supervisors understand what your code does
86-
- Explain (the purpose of) code that is not self-explanatory
87-
- Comment and un-comment to debug code without having to delete it[^1]
88-
89-
```{r}
90-
# Print a very important line
91-
print("A very important line")
92-
```
93-
94-
[^1]: You should delete non-working code when done debugging though.
95-
9659
## The Data Science workflow
9760

9861
![Source: [R 4 Data Science](https://r4ds.had.co.nz/introduction.html)](https://d33wubrfki0l68.cloudfront.net/571b056757d68e6df81a3e3853f54d3c76ad6efc/32d37/diagrams/data-science.png "The data science workflow."){fig-align="center"}

course-materials/datascience_exercises.Rmd

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ We are going to clean up our data by selecting/filtering only the relevant infor
7777

7878
## Exercise 4
7979

80-
We are going to select columns with relevant data, for our upcoming analysis.
80+
We are going to select columns from the `penguins` dataframe with relevant data, for our upcoming analysis.
8181
The research we do is on penguin bill sizes (described in our data with the word "Culmen").
8282

8383
We want to include a few relevant variables so we can analyse them later:
@@ -90,8 +90,6 @@ We want to include a few relevant variables so we can analyse them later:
9090

9191
Use the function `select()` to include the right columns in our data subset.
9292

93-
**Note** that in order to work with the subset from Exercise 4, we need to use that data frame (`penguin_subset`) as our data input!
94-
9593
```{r}
9694
penguins_subset <- ???
9795
```

0 commit comments

Comments
 (0)