Usage Arguments Details Value Examples
1 | matchWeatherToShots(shots, weather)
|
shots |
data.frame input first year of events to return, Defaults to 0 (no lower bound) |
data.frame |
weather all weather obs for the tournament |
get_cumulative_rain <- function(obs_time, weather) hours_to_look <- c(1, 2, 4, 6, 12, 18, 24, 36, 48)
weather_time_diff <- weather$date_time - obs_time units(weather_time_diff) <- "mins"
rain_before_obs <- lapply(hours_to_look, function(x) return(sum(weather[which(weather_time_diff > - x * 60 & weather_time_diff <= 0), "precip"], na.rm = TRUE)) )
rain_df <- data.frame(as.list(rain_before_obs)) colnames(rain_df) <- paste0("rain_", hours_to_look, "_hrs_before")
return(rain_df) matchWeatherToShots
This function takes all shots in a tournament, and all weather observations we have for the tournament and returns a dataframe with relevant weather info for each shot
Data Frame summary weather info for each shot
1 | matchWeatherToShots(safeway.shots, safeway.weather)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.