/Weather-App-Shinyapps

This is a repository that guides how to deploy a weather app on Shinyapps.io

Primary LanguageR

Weather-App-Shinyapps

This is a repository that guides how to deploy a weather app on Shinyapps.io.

The app provides current weather information and forecasts for the next five days.

The app will appear as follows:

Alt text

Steps to use the app:

  • Find the location you want to view on the map and use the mouse to hover over it.
  • In the tab named 'Weather,' it will display weather information at that location, including: Location, Humidity, Temperature, Feels Like, Weather Condition, Visibility, Wind Speed.

Alt text

  • In the 'Forecast' tab, a Line chart will display the weather forecast for the selected location for the next 5 days, including information about temperature (temp), feels_like, temp_min, temp_max, pressure, sea_level, grnd_level (ground level), humidity, speed, deg, gust.

Alt text

Step 1: Get API Keys for Weather information

  • Go to Open Weather Map and sign in (or sign up if you do not have any account).
  • Get API Keys

Alt text

Step 2: Code R get information about weather by API_keys

Note: Use RStudio to code this app. Link to download here. Go to app.R and see the functions which I built carefully:

  • get_weather_info: to get the information of weather .
  • get_forecast: to get the forecast of weather in specific location within 5 days.
  • ui: to set up the UI for your app. It contains 2 tabnames: Weather & Forecast.
  • server: process the logic to display your app.

If you want to test your app in localhost, you can click on RunApp (recommend choose Run in Viewer Pane mode)

Alt text

Step 3: Deploy your app on Shinyapps.io

Alt text

  • Click on "Show" -> "Show Secret" -> "Copy to Clipboard"

Alt text

  • Click on the publish icon (which is right of RunApp icon) and choose "Clear List" (if necessary)

Alt text

  • Choose "Publish Application..."

Alt text

  • Add account by clicking on "Add New Account" -> "ShinyApps.io" -> paste Token -> "Connect Account"

Alt text

  • Choose all files and set title name

Alt text

  • Click on "Publish" and wait to deploy!!!
  • As soon as finish the deployment, on the Shinyapps.io, you can see your app here.

Alt text

  • Click on the URL which is hidden in "Name" you can see in above image (e.g: "lab4"), this is information about the app.

Alt text

You can explore more by yourself!!!

Thanks for reading!!! Have a nice day!!!

Other sources you can refer to

Author: Pham Nguyet