Learn R Programming

openmeteo (version 0.2.4)

weather_now: Retrieve Current Weather from the Open-Meteo API

Description

weather_now() calls the Open-Meteo weather API for the most recently recorded weather conditions a given location. Location is provided either as string or c(latitude,longitude).

Usage

weather_now(location, response_units = NULL, timezone = "auto")

Value

Current weather conditions: temperature, windspeed, wind direction and weathercode.

Arguments

location

Required. The location for which data will be retrieved. Supplied as either a c(latitude,longitude) WGS84 coordinate pair or a place name string (with co-ordinates obtained via geocode()).

response_units

Supply to convert temperature, windspeed, or precipitation units. This defaults to: list(temperature_unit = "celsius", windspeed_unit = "kmh", precipitation_unit = "mm")

timezone

specify timezone for time data as a string, i.e. "australia/sydney" (defaults to "auto", the timezone local to the specified location).

Examples

Run this code
# \donttest{
# current weather in Montreal
weather_now("Montreal")

# current weather at the North Pole in Imperial units
weather_now(c(90, 0),
  response_units = list(
    temperature_unit = "fahrenheit",
    windspeed_unit = "mph"
  )
)
# }

Run the code above in your browser using DataLab