Learn R Programming

datagovsgR (version 0.3.0)

weather_reading: Weather Reading

Description

This functions calls upon the weather reading API from data.gov.sg and returns a list containing the air temperature, rainfall, relative humidity, wind direction and speed across Singapore. Data is updated every 5 minutes for the rainfall API, and every half minute for the other 4 API from NEA.

Usage

weather_reading(date_time = "", simplify = FALSE)

Arguments

date_time

Defaults to current (SGD) time. Format: YYYY-MM-DDTHH:MM:SS

simplify

Defaults to FALSE. Otherwise, simplify = TRUE would return a data frame where all 5 metrics are joined according to weather stations, but return several NAs, as most weather stations collect rainfall data only.

Value

A dataframe containing various weather readings from weather stations

Details

This API takes slighlty longer than the other APIs in the package as 5 APIs are wrapped within this function.

Examples

Run this code
# NOT RUN {
weather_reading()
weather_reading(date = "2019-11-08T17:30:00")
weather_reading(date = "2018-01-04T09:16:17", simplify = TRUE)
# }

Run the code above in your browser using DataLab