yr_bike_recommendation: Get a recommendation for your next bike ride.

Description Usage Arguments Examples

View source: R/yr_bike_recommendation.R

Description

Function to get the weather forecast and a recommendation for a specified hourly period. Usually you get weather forecasts for the whole day instead of the hours that you are interested in, for example, the hours you usually bike to or from work. This makes it hard to plan the clothes you need to wear or even decide if you are going to bother fighting the weather. This function can help you plan and/or decide what to do.

Usage

1
2
3
yr_bike_recommendation(place = NULL, country = NULL, place_url = NULL,
  hour, forecast_date = Sys.Date() + 1, hours_safety = 0, min_list = NULL,
  max_list = NULL, return_boolean = FALSE)

Arguments

place

City you want to ride your bike from. It is recommended to use the place_url instead of place (and country) as these params needs more requests and webscraping to get to the final results.

country

To two digit country code. Ex: "DK", "SE", "US".

place_url

The page you get, when you search for a place on YR.no. Ex http://www.yr.no/place/Denmark/Capital/Copenhagen

hour

The hour you want to ride your bike.

forecast_date

Default is current date.

hours_safety

The safety margin subtracted and added to the hour param.

min_list

Supply a named list of weather variables to test if they are higher than or equal to the supplied value.

max_list

Supply a named list of weather variables to test if they are lower than or equal to the supplied value.

return_boolean

Do you want the function to return a boolean?

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
## Not run: 
library(yrno)

yr_bike_recommendation(place = "Copenhagen",
                       hour = 7,
                       forecast_date = Sys.Date() + 1,
                       hours_safety = 1)

yr_bike_recommendation(place_url = "https://www.yr.no/place/Denmark/Capital/Copenhagen/",
                       hour = 7,
                       forecast_date = Sys.Date() + 1,
                       hours_safety = 1)

yr_bike_recommendation(place_url = "https://www.yr.no/place/Denmark/Capital/Copenhagen/",
                       hour = 7, forecast_date = Sys.Date() + 1,
                       hours_safety = 1,
                       max_list = list(temperature_value = 5))

yr_bike_recommendation(place_url = "https://www.yr.no/place/Denmark/Capital/Copenhagen/",
                       hour = 7, forecast_date = Sys.Date() + 1,
                       hours_safety = 1,
                       min_list = list(temperature_value = 5),
                       max_list = list(precipitation_value = 0.1))

## End(Not run)

krose/yrno documentation built on May 20, 2019, 6:42 p.m.