From ce263ac06a7b5f3ca1f14f421cb76c0f2e1b072e Mon Sep 17 00:00:00 2001 From: Damiano Oldoni Date: Mon, 25 Sep 2023 13:57:12 +0200 Subject: [PATCH] Split challenge 2 in two slides 20230926 --- docs/sessions/20230926_functions_in_r.html | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/docs/sessions/20230926_functions_in_r.html b/docs/sessions/20230926_functions_in_r.html index 57024db5..01d9cdfc 100644 --- a/docs/sessions/20230926_functions_in_r.html +++ b/docs/sessions/20230926_functions_in_r.html @@ -289,7 +289,7 @@ background-image: url({{ site.baseurl}}/assets/images/background_challenge_2.png) class: left, top -# Challenge 2 +# Challenge 2A How does Dr Z proceed to write the following functions? @@ -298,12 +298,21 @@ - `max_coord_uncertain`: maximum of `coordinateUncertaintyInMeters` (numeric), deafult value as in script. - `issues_to_discard`: issues whose obs have to be filtered out (character vector), default value as in script. - `occurrenceStatus_to_discard`: the `occurrenceStatus` values whose obs have to be filtered out (character vector), default value as in script. -2. `calc_grid_cell()`: function to return the input data.frame with an extra column containing the cell code (step 3). Allow users to specify different cell sizes (lat/lon). Default values as in script -3. `calc_n_obs_ind`: function to calculate the number of observations and individuals in each grid cell (step 4) -4. `plot_distr_cells()`: function to create a histogram showing the cells distribution for both number of observations and number of individuals (step 5). Allow the user to choose the histogram binwidth. Default value as in script. Notice also that there are other hardcoded values in title which should be transformed to variables. +2. `calc_grid_cell()`*: function to return the input data.frame with an extra column containing the cell code (step 3). Allow users to specify different cell sizes (lat/lon). Default values as in script.
- __\* Note__: `!!sym()` commando can help you to use the longitude/latitude colnames in the `mutate()` + __\* Note__: `!!sym()` commando can help you to pass the longitude/latitude column names as variables in the `mutate()` + +--- +background-image: url({{ site.baseurl}}/assets/images/background_challenge_2.png) +class: left, top + +# Challenge 2B + +How does Dr Z proceed to write the following functions? + +3. `calc_n_obs_ind`: function to calculate the number of observations and individuals in each grid cell (step 4) +4. `plot_distr_cells()`: function to create a histogram showing the cells distribution for both number of observations and number of individuals (step 5). Allow the user to choose the histogram binwidth. Default value as in script. Notice also that there are other hardcoded values in title. What is the best way to proceed? --- class: left, top