Code
# SET UP #######################################################################
## Load packages ---------------------------------------------------------------
library(tidyverse)── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr 1.2.1 ✔ readr 2.2.0
✔ forcats 1.0.1 ✔ stringr 1.6.0
✔ ggplot2 4.0.3 ✔ tibble 3.3.1
✔ lubridate 1.9.5 ✔ tidyr 1.3.2
✔ purrr 1.2.2
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
Code
library(EVR628tools)✔ ✔ ✔ You sucessfully loaded the EVR628tools package ✔ ✔ ✔
Code
## Load data -------------------------------------------------------------------
data("data_lionfish")
site_histogram <- function(data, my_site) {
# Filter my data
inside_data <- data |>
filter(site == my_site)
# Build my plot
p <- ggplot(inside_data,
mapping = aes(x = total_length_mm)) +
geom_histogram(binwidth = 50)
# Return my plot
return(p)
}
site_histogram(data = data_lionfish,
my_site = "Paraiso")