# INBO CODING CLUB 30 August 2022 Welcome! ## Share your code snippet If you want to share your code snippet, copy paste your snippet within a section of three backticks (```): As an **example**: ``` library(tidyverse) ``` (*you can copy paste this example and add your code further down*) ## Yellow sticky notes No yellow sticky notes online. Put your name + " | " and add a "*" each time you solve a challenge (see below). ## Participants Name | Challenges --- | --- Damiano Oldoni | Emma Cartuyvels |** Dirk Maes | Sarah Broos| Adriaan Seynaeve | Amber Mertens | Lucia Manzanares | Oberon Geunens | Frank Huysentruyt | ## Challenge 1 ``` ##Lucia survey %>% ggplot(aes(x= weight, y=hindfoot_length)) + geom_point() survey %>% ggplot(aes(x= species_id, y=weight)) + geom_boxplot() survey %>% ggplot(aes(x= species_id, y=weight)) + geom_violin() survey %>% ggplot(aes(x= sex)) + geom_bar() survey %>% ggplot(aes(x=year)) + geom_bar() survey_per_year %>% ggplot(aes(x=year, y=n)) + geom_col() ``` ## Challenge 2 Emma: ``` ggplot(data = survey) + geom_boxplot(mapping = aes(x = species_id, y = weight), alpha = 0.05, color = "blue") # 2. First plot # Basic plot to start with ggplot(data = survey, mapping = aes(x = weight, y = hindfoot_length, color = sex)) + geom_point(alpha = 0.5) + labs(y = "hindfoot length", title = "hindfoot length vs weight") + scale_x_log10() + scale_color_manual(values=c("red", "yellow")) # 3. Second plot # Basic plot to start with ggplot(data = survey, mapping = aes(y = year)) + geom_bar(aes(fill = sex), position = "dodge", alpha = 0.5) + labs(x = "number of surveys", title = "Number of surveys per year") ``` ## Challenge 3 Amber: ``` # 1. survey %>% ggplot() + geom_boxplot(mapping = aes(x = as.factor(year), y = weight, color = sex )) # 2. survey %>% ggplot() + geom_boxplot(mapping = aes(x = cut_width(year, width = 5), y = weight, color = sex )) # 3. p <- ggplot(data = survey, mapping = aes(x = weight, y = hindfoot_length, color = sex)) + geom_point(alpha = 0.5) + ylab("hindfoot length") + ggtitle("hindfoot length vs weight") + scale_x_log10() p + facet_grid(cols = vars(sex), rows = vars(plot_id), labeller = label_both ) ```