knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
The goal of weatherapi is to wrap the weather api accessible through weatherapi.com. This API enables us to get current and historical weather information, astronomical information, local time-zone information, and sports events information.
api_key()
: to set the API key for the packageget_current_weather()
: to get the current real-time weather information for a location or multiple locations (e.g. Kelowna, Vancouver)get_time_zone()
: to get the current time-zone information for a location or multiple locations (e.g. Kelowna, Vancouver)get_sports_events()
: to get the sports events information for a location or multiple locations (e.g. Kelowna, Vancouver)get_astronomy()
: to get up to date information for sunrise, sunset, moonrise, moonset, and moonphaseget_history_astro_information()
: to get historical information for sunrise, sunset, moonrise, moonset, and moonphaseget_history_daily_weather()
: to get historical daily weather informationget_history_hourly_weather()
: to get historical hourly weather informationYou can install the development version of weatherapi from GitHub with:
devtools::install_github("xintian927/534-project")
This package relies on the API key provided by the Weather API. To get started on using this package, please follow these steps:
usethis::edit_r_environ()
API_KEY = <your_api_key>
This is an example which shows you how to get the current weather information:
library(weatherapi) get_current_weather("Kelowna")
You can also generate plots, for example:
library(ggplot2) library(reshape2) # Get current weather data loc <- c("London", "New York", "Paris", "Melbourne", "Singapore") data <- get_current_weather(loc,"no") # Get temperature info and melt dataframe data <- data[c("location.name", "current.temp_c", "current.feelslike_c")] data <- melt(data) # Plot temperature ggplot(data=data, aes(x=location.name, y=value, group=variable, linetype=variable)) + geom_line()+ geom_point()+ labs(title="Temperature by Location", subtitle="(in celcius)", x="", y="", linetype="")
If you encounter a clear bug, you can email us at:
- evelynsugihermanto@yahoo.com
- lianqi20209@gmail.com
- tjyh111@163.com
- veeramanival@gmail.com
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.