Skip to content

Instantly share code, notes, and snippets.

@HughParsonage
Created June 25, 2017 01:03
Show Gist options
  • Save HughParsonage/e002e8929ac2ec592f10ee22ce9dac1f to your computer and use it in GitHub Desktop.
Save HughParsonage/e002e8929ac2ec592f10ee22ce9dac1f to your computer and use it in GitHub Desktop.
Prints the weather at your location (based on IP)
if (requireNamespace("bomrang", quietly = TRUE)) {
library(data.table)
library(bomrang) # devtools::install_github('ToowoombaTrio/bomrang')
`_nrst_stn_to_me` <- as.numeric(jsonlite::fromJSON("http://ip-api.com/json")[c("lat", "lon")])
weather_here <- function() {
bomrang::get_current_weather(latlon = `_nrst_stn_to_me`, as.data.table = TRUE) %>%
.[, .(local_date_time, weather, rel_hum, apparent_t, air_temp, wind_dir, wind_spd_kt, gust_kt)] %>%
head
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment