Open stephpenn1 opened 5 years ago
make_tree_data <- function(inventory_data, species_codes, plot_data) { inventory_data %>% left_join(species_codes, by = "Species_code") -> trees unmatched <- filter(trees, is.na(Species)) if(nrow(unmatched)) { warning("Species codes not found:", unique(unmatched$Species_code)) } trees %>% filter(Site == "SERC") %>% # temporary - only handle SERC left_join(select(plot_data, Site, Plot, Plot_area_m2), by = c("Site", "Plot")) }
> f <- function(a) { print(a) } > a <- 2 > f(1)
Pythagorean theorem: a2+b2=c2 Write a function that, given the lengths of two sides of the triangle, calculates the length of the third side.
stop()
(from https://cfss.uchicago.edu/homework/programming/)
Question 1: add comments before each code chunk explaining what is happening in this function