Quarto enables you to weave together content and executable code into a finished document. To learn more about Quarto see https://quarto.org.
Running Code
When you click the Render button a document will be generated that includes both content and the output of embedded code. You can embed code like this:
#install.packages("rinat")#next you need to tell R to load the packages you just installed. You need to do this every time you open R.library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr 1.1.4 ✔ readr 2.1.6
✔ forcats 1.0.1 ✔ stringr 1.6.0
✔ ggplot2 4.0.1 ✔ tibble 3.3.0
✔ lubridate 1.9.4 ✔ tidyr 1.3.1
✔ purrr 1.2.0
── 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
library(rinat)# Plotting the data in Washingtonbeav_inat_wa <-get_inat_obs(taxon_name ="beaver",#taxon_id = "43794", #American Beaver 43794place_id =46, #46 is for Washington, 502 is Clark County geo =TRUE, #Specifies that we want geocoordinatesmaxresults =4000, #Limits results... meta =FALSE)states <-map_data("state")washington <- states %>%filter(region %in% ("washington")) #make sure to use lowercase.which_state <-"washington"county_info <-map_data("county", region=which_state) # county boundariesbeav_ggplot <-ggplot(data = county_info) +geom_polygon(aes(x = long, #base mapy = lat,group = group),fill ="white", #background colorcolor ="darkgray") +#border colorcoord_quickmap() +geom_point(data = beav_inat_wa, mapping =aes(x = longitude,y = latitude,fill = quality_grade), #changes color of point basedcolor ="black", #outline of pointshape=21, #this is a circle that can be filledalpha=0.7) +#alpha sets transparency (0-1) theme_bw() +#just a baseline themetheme(plot.background=element_blank(), #removes plot backgroundpanel.background =element_rect(fill ="white"), #sets panel backgroundpanel.grid.major =element_blank(), #removes x/y major gridlinespanel.grid.minor =element_blank()) #removes x/y minor gridlinesbeav_ggplot #this allows you to see the map
You can add options to executable code like this
The echo: false option disables the printing of code (only output is displayed).