matchWeatherToShots: #' get_cumulative_rain #' #' This function turns the rain...

Usage Arguments Details Value Examples

Usage

1
matchWeatherToShots(shots, weather)

Arguments

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

Details

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

Value

Data Frame summary weather info for each shot

Examples

1
matchWeatherToShots(safeway.shots, safeway.weather)

cdepeuter/golf_analytics documentation built on May 13, 2019, 2:33 p.m.