Skip to content

Commit

Permalink
Improve slides 20240926
Browse files Browse the repository at this point in the history
  • Loading branch information
damianooldoni committed Sep 25, 2024
1 parent 677399c commit 0ac58b5
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions docs/sessions/20240926_from_stand_alone_code_to_functions.html
Original file line number Diff line number Diff line change
Expand Up @@ -222,36 +222,42 @@
2. Use them to rewrite `make_doughs()`.

<br>
<small> \* Atomic = not divisible in smaller parts. This definition is still current in use even if in some ways outdated: atoms are divisible in smaller parts :-) </small>
<small> \* Atomic = not divisible in smaller parts. Ok, atoms are divisible in smaller parts, but we are not in the atomic world :-) </small>

---
class: left, top

.center[![:scale 10%]({{ site.baseurl}}/assets/images/20240926/20240926_film.png)]

# Antwerp's Unlikely Allies: Ladybeetles, Grasshoppers, and Data Science
# The Antwerp trilogy: Ladybeetles, Grasshoppers, and Data Science

Once upon a time there was a biologist, Dorothy*. She received in January 2011 observations of the asian ladybeetle (_Harmonia axyridis_) collected in the surroundings of Antwerp. These observations are stored in [20240926_harmonia_axyridis_2010.txt](https://github.com/inbo/coding-club/blob/master/data/20240926/20240926_harmonia_axyridis_2010.txt). She wrote some code to read the observations, do some data wrangling and plot the results. You can find the code in [20240926_challenges.R](https://github.com/inbo/coding-club/blob/master/src/20240926/20240926_challenges.R).

What seemed to be a one-shot anlysis, becomes very soon something more: she receives a similar file from another contractor containing observations of the bow-winged grasshopper (_Chorthippus biguttulus_) collected in the same area: [20240926_chorthippus_biguttulus_2010.txt](https://github.com/inbo/coding-club/blob/master/data/20240926/20240926_chorthippus_biguttulus_2010.txt).

<br>
<small> __\* Dorothy is a tribute to [Dorothy Crowfoot Hodgkin](https://en.wikipedia.org/wiki/Dorothy_Hodgkin), a British chemist who won the Nobel Prize in Chemistry in 1964. She was a pioneer in the field of X-ray crystallography to study interesting biological molecules. Among others, she discovered the structure of the vitamine B12. </small>
<small> __\* The fictive Dorothy character is a tribute to [Dorothy Crowfoot Hodgkin](https://en.wikipedia.org/wiki/Dorothy_Hodgkin), a British chemist who won the Nobel Prize in Chemistry in 1964. She was a pioneer in the field of X-ray crystallography to study interesting biological molecules. Among others, she discovered the structure of the vitamine B12. </small>


---
class: left, top

.center[![:scale 10%]({{ site.baseurl}}/assets/images/20240926/20240926_film.png)]

# Antwerp's Unlikely Allies: Ladybeetles, Grasshoppers, and Data Science
# The Antwerp trilogy: Ladybeetles, Grasshoppers, and Data Science

Dorothy also learns that she will have to redo the same analysis in the future, for sure on observations of the Asian ladybeetle, [20240926_harmonia_axyridis_2011.txt](https://github.com/inbo/coding-club/blob/master/data/20240926/20240926_harmonia_axyridis_2011.txt)

And, she is afraid, new data of bow-winged grasshopper will find her sooner or later. I think you can find yourself in the role of Dorothy.

Before starting, a **best practice reminder**: write the functions in a **separate file**.
You can call it `20240926_functions.R`. You can use your functions in the challenge file by first *sourcing* this file, e.g. `source("./src/20240926/20240926_functions.R")` or clikcing the "Source" button in RStudio.

---
class: left, top

# Best practices

Before starting, a **best practice** reminder: write the functions in a **separate file**.
You can call it `20240926_functions.R`. This function should contain ONLY the functions. You can use your functions in the challenge file by first *sourcing* this file, e.g. `source("./src/20240926/20240926_functions.R")` or clikcing the "Source" button in RStudio.


---
Expand Down Expand Up @@ -303,7 +309,7 @@
background-image: url({{ site.baseurl}}/assets/images/background_challenge_2.png)
class: left, top

# Challenge 2A - Defaults
# Challenge 2: defaults and arguments

How does Dorothy proceed to write the following functions?

Expand Down Expand Up @@ -377,7 +383,7 @@
---
class: left, top

# Challenge 3
# Challenge 3: automatize the workflow

Now that we have all blocks, automatize the entire workflow by creating a macrofunction called analyse_obs() embedding all steps developed in the previous challenges. Think about which arguments you need as input. Return a named list containing:

Expand Down

0 comments on commit 0ac58b5

Please sign in to comment.