By hand: Evaluate \(f(x,y)=x^2-1+3xy\) at \(x=1\) and \(y = 0\)
In the R Console: given \(G(t,z)=3.1(t-4.2)^2 + 0.06z\), find the value of \(G(1, 2.5)\) (you do NOT need to write a function - just do the calculation in R using R as a calculator)
What is the total unrecovered amount of oil spilled into the watershed that year, in barrels. Use R & Google here for calculations.
Create a new Quarto project (named
eds-212-day-1
)
Add a new Quarto document in the project
Press ‘Render’ (save this in your project as
fish-length-weight.qmd
)
Delete everything below the first code chunk
Attach the tidyverse
package
Play around with markdown cells in the Quarto doc. Try adding text with at least the following:
Add a new code chunk (for R code)
Within the R code chunk, write a function to estimate fish standard weight, given parameters \(a\), \(b\), and fish length \(L\) as inputs. “Standard weight” is how much we expect a fish to weigh, give the species and fish length, and the nonlinear relationship is given by:
\[W=aL^b\]
where L is total fish length (centimeters), W is the expected fish weight (grams), and a and b are species-dependent parameter values.
Test out your function to find the mass (g) for a 60 cm fish of the following species (parameter estimates from Peyton et al. (2016)):
Peyton, K. A., T. S. Sakihara, L. K. Nishiura, T. T. Shindo, T. E. Shimoda, S. Hau, A. Akiona, and K. Lorance. 2016. “Length–Weight Relationships for Common Juvenile Fishes and Prey Species in Hawaiian Estuaries.” Journal of Applied Ichthyology 32 (3): 499–502. https://doi.org/10.1111/jai.12957.
Make and store (as fish_length
) sequence of size
ranges from 0 to 200 cm, by increments of 1 cm
Estimate the weight for giant barracudas along that entire range
(given the parameters above). Store the output as
barracuda_weight
Bind the lengths and estimated barracuda weights into a single
data frame using data.frame()
Create a ggplot graph of predicted length versus weight for giant barracuda
Update the graph axis labels and title
Render the .qmd. Make sure everything is saved.
Close your project. Reopen the project, and ensure that you can re-run the entire Quarto document (reproducibility check).