From f69e1d5b50fed4b58c49b7f90d7a3f83e195df58 Mon Sep 17 00:00:00 2001
From: Thomas Rushby <t.w.rushby@soton.ac.uk>
Date: Tue, 22 Sep 2020 14:21:36 +0100
Subject: [PATCH] Update current weather message and icon saving.

---
 howTo/apiOpenWeather.R | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/howTo/apiOpenWeather.R b/howTo/apiOpenWeather.R
index 200ea67..cdca523 100644
--- a/howTo/apiOpenWeather.R
+++ b/howTo/apiOpenWeather.R
@@ -50,9 +50,10 @@ hourlyWeather <- unnest(hourlyWeather, cols = weather)
 # What to do with the data & presentation info
 # ..$pop = probablility of precipitation
 
+message(paste0("The weather now is: ",currentWeather$weather$main, " and the temperature is ",round(currentWeather$temp)," degrees."))
+
 # Get icons - URLs
-icon <- "10d"
+icon <- currentWeather$weather$icon
 iconURL <- paste0("http://openweathermap.org/img/wn/",icon,"@2x.png")
 download.file(iconURL,paste0(here::here(),'/howTo/weatherAPI/icons/',icon,'.png'), mode = 'wb')
 
-message(paste0("The weather now is: ",currentWeather$weather$main, " and the temperature is ",round(currentWeather$temp)," degrees."))
-- 
GitLab