knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(HW5262)
library(tidyverse)
# example data temp_data = data.frame( Date = c(1895:2019), Value = sample(1:1, 125, replace = T) ) head(temp_data, 10) # tells you whether there was a drought in the specified year given inputed drought index and threshold value calc_if_drought(temp_data, 2, 1, 2000)
# preloaded data data("rain") calc_extreme_rain_anom(rain)
# example data temp_test_data = data.frame( Date = c(1:4), Value = c(1:4), Anomaly = c(1:4) ) temp_test_data calc_extreme_temp_anom(temp_test_data)
#create some fake climate data #springtime mean temperatures by date and location crop_temp = rnorm(500, mean = 16 , sd = 2) dates = seq(from = 1920, to = 2010, by = 10) locations = c("SB", "LA", "SF","SLO","SD") ca_temp <- matrix(crop_temp, nrow = 10, ncol = 5, dimnames = list(c(dates), c(locations))) #what example dataframe would look like ca_temp # function output: calc_crop_harvest(ca_temp, 15, .5)
# example dataset crop_rain = rnorm(500, mean = 10 , sd = 4) dates = seq(from = 1920, to = 2010, by = 10) locations = c("SB", "LA", "SF","SLO","SD") ca_rain <- matrix(crop_rain, nrow = 10, ncol = 5, dimnames = list(c(dates), c(locations))) # example of what data looks like ca_rain #function output calc_crop_cost(ca_rain, 10, .5, 1000, 1.50)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.