Skip to content

Commit 6f05c8f

Browse files
Merge pull request #15 from crazycapivara/develop
Develop / v0.8.0
2 parents 71be0cc + a915fe5 commit 6f05c8f

File tree

152 files changed

+39502
-912
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

152 files changed

+39502
-912
lines changed

.Rbuildignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
^docs$
2+
^_pkgdown\.yml$
13
^.*\.Rproj$
24
^\.Rproj\.user$
35
data-raw/
@@ -9,3 +11,4 @@ TODO.md
911
docs/
1012
README.rmd
1113
cran-comments.md
14+
vignettes/owmr.Rmd

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
.Rhistory
33
.RData
44
tmp/
5+
inst/doc

DESCRIPTION

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
Package: owmr
22
Title: OpenWeatherMap API Wrapper
3-
Version: 0.7.2
4-
Authors@R: person("Stefan", "Kuethe", email = "crazycapivara@gmail.com", role = c("aut", "cre"))
3+
Version: 0.8.0
4+
Date: 2018-11-02
5+
Authors@R: c(
6+
person("Stefan", "Kuethe", email = "crazycapivara@gmail.com", role = c("aut", "cre")),
7+
person("Amanda", "Dobbyn", role = "ctb")
8+
)
9+
Maintainer: Stefan Kuethe <crazycapivara@gmail.com>
510
Description: Accesses OpenWeatherMap's (owm) <https://openweathermap.org/> API.
611
'owm' itself is a service providing weather data in the past, in the future and now.
712
Furthermore, 'owm' serves weather map layers usable in frameworks like 'leaflet'.
@@ -17,11 +22,14 @@ Depends:
1722
Imports:
1823
magrittr,
1924
httr,
20-
jsonlite
25+
jsonlite,
26+
plyr,
27+
tibble,
28+
tidyr
2129
License: MIT + file LICENSE
2230
Encoding: UTF-8
2331
LazyData: true
24-
RoxygenNote: 5.0.1
32+
RoxygenNote: 6.0.1
2533
Suggests:
2634
leaflet,
2735
whisker,

NAMESPACE

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
11
# Generated by roxygen2: do not edit by hand
22

3+
S3method(owmr_as_tibble,default)
4+
S3method(owmr_as_tibble,owmr_forecast_daily)
5+
S3method(owmr_as_tibble,owmr_weather)
36
export("%$$%")
7+
export("%<>%")
48
export("%>%")
59
export(add_owm_tiles)
610
export(add_weather)
711
export(cbind_weather)
812
export(find_cities_by_geo_point)
913
export(find_city)
10-
export(find_stations_by_geo_point)
1114
export(flatten)
1215
export(flatten_weather)
1316
export(get_current)
1417
export(get_current_for_group)
15-
export(get_current_from_station)
1618
export(get_forecast)
1719
export(get_forecast_daily)
1820
export(get_icon_url)
19-
export(owm_layers)
21+
export(owmr_as_tibble)
2022
export(owmr_settings)
2123
export(parse_columns)
2224
export(remove_prefix)

NEWS.md

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,54 @@
1-
# owmr 0.3.0
1+
# owmr 0.8.0
22

3-
* Added a `NEWS.md` file to track changes to the package.
3+
* Added generic function `owmr_as_tibble` to get similiar-ish and tidy data frames
4+
for all kind of responses
5+
* Removed `find_stations_by_geo_point` and `get_current_from_station` because of a new
6+
_owm stations api_
47

5-
# owmr 0.4.0
8+
# owmr 0.7.4
69

7-
* Added function to search owm's city list by city name.
8-
* Added tests for current data.
9-
- Added helper function to fetch 'fresh' data used in tests.
10+
* Fixed bug in `add_owm_tiles`
11+
* `find_stations_by_geo_point` and `get_current_from_station` are not supported anymore because of breaking changes in the owm api for stations. Functions will be removed in a future version.
1012

11-
# owmr 0.4.1
13+
# owmr 0.7.3
1214

13-
* Added function to fetch current weather data for multiple cities at once.
15+
* Added feature to store the api key in an environment variable called `OWM_API_KEY`
16+
* It is still possible to set the key via `owmr_settings`, but it is recommended that you use the environment variable instead
1417

15-
# owmr 0.5.0
18+
# owmr 0.7.2
1619

17-
* Refactored code
18-
* Added function to fetch current weather data for cities around geo point (more or less an alias to `find_city`).
19-
* Marked UTF-8 string in data fixed.
20+
* Updated package description
2021

21-
# owmr 0.6.1
22+
# owmr 0.7.1
2223

23-
* Added function to show weather data on leaflet map.
24-
- Added operator `%$$%` to render template text for popups.
24+
* Fixed false poitives in check for undefined global variable `.` from `magrittr`
2525

2626
# owmr 0.7.0
2727

2828
* Added functions to add owm tiles to leaflet map.
2929
- Note: Performance of owm tile server seems to be low.
3030

31-
# owmr 0.7.1
31+
# owmr 0.6.1
3232

33-
* Fixed false poitives in check for undefined global variable `.` from `magrittr`
33+
* Added function to show weather data on leaflet map.
34+
- Added operator `%$$%` to render template text for popups.
3435

35-
# owmr 0.7.2
36+
# owmr 0.5.0
3637

37-
* Updated package description
38+
* Refactored code
39+
* Added function to fetch current weather data for cities around geo point (more or less an alias to `find_city`).
40+
* Marked UTF-8 string in data fixed.
41+
42+
# owmr 0.4.1
43+
44+
* Added function to fetch current weather data for multiple cities at once.
45+
46+
# owmr 0.4.0
47+
48+
* Added function to search owm's city list by city name.
49+
* Added tests for current data.
50+
- Added helper function to fetch 'fresh' data used in tests.
51+
52+
# owmr 0.3.0
53+
54+
* Added a `NEWS.md` file to track changes to the package.

R/city_list.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#' Look up coordinates and city id in owm's city list.
22
#'
3-
#' search \code{\link{owm_cities}} dataset by city name
4-
#' and country code
3+
#' Search \code{\link{owm_cities}} dataset by city name
4+
#' and country code.
55
#'
66
#' @seealso \code{\link{owm_cities}} dataset
77
#'
@@ -16,7 +16,7 @@
1616
#' search_city_list("London", "GB")
1717
#' search_city_list("London")
1818
#' search_city_list("Lond")
19-
search_city_list <- function(city, country_code = ""){
19+
search_city_list <- function(city, country_code = "") {
2020
result <- grepl(city, owmr::owm_cities$nm) &
2121
grepl(country_code, owmr::owm_cities$countryCode)
2222
owmr::owm_cities[result, ]

R/current-bbox.R

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
find_cities_by_bbox <- function(bbox = c(12,32,15,37,10), ...) {
2+
get <- owmr_wrap_get("box/city")
3+
get(bbox = paste0(bbox, collapse = ","), ...) %>%
4+
owmr_parse() %>%
5+
owmr_class("owmr_box_city")
6+
}

R/current-multiple.R

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#' @param city_ids numeric vector containing city ids
77
#' @param ... see owm api documentation
88
#'
9-
#' @return list containing data frame with current weather data of cities
9+
#' @return list
1010
#' @export
1111
#'
1212
#' @examples \dontrun{
@@ -15,31 +15,31 @@
1515
#' result$cnt == nrow(result$list)
1616
#' weather_frame <- result$list
1717
#' }
18-
get_current_for_group <- function(city_ids, ...){
18+
get_current_for_group <- function(city_ids, ...) {
1919
get <- owmr_wrap_get("group")
2020
get(id = paste(city_ids, collapse = ",")) %>%
21-
owmr_parse()
21+
owmr_parse() %>%
22+
owmr_class("owmr_group")
2223
}
2324

2425
#' Find cities by geo point.
2526
#'
2627
#' Get current weather data for a number of cities
27-
#' around given geo point.
28+
#' around a given geo point.
2829
#'
2930
#' @param lat latitude of geo point
3031
#' @param lon longitude of geo point
3132
#' @param cnt number of cities
3233
#' @param ... see owm api documentation
3334
#'
34-
#' @return list containing data frame with weather data
35-
#'
35+
#' @return list
3636
#' @export
3737
#'
3838
#' @seealso \code{\link{find_city}}
3939
#'
4040
#' @examples \dontrun{
4141
#' find_cities_by_geo_point(lat = 51.50853, lon = -0.12574, cnt = 5)
4242
#' }
43-
find_cities_by_geo_point <- function(lat, lon, cnt = 3, ...){
43+
find_cities_by_geo_point <- function(lat, lon, cnt = 3, ...) {
4444
find_city(lat = lat, lon = lon, cnt = cnt, ...)
4545
}

R/current.R

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@
1414
#' get_current(lon = -0.09184, lat = 51.51279)
1515
#' get_current(zip = "94040,US")
1616
#' }
17-
get_current <- function(city = NA, ...){
17+
get_current <- function(city = NA, ...) {
1818
get <- owmr_wrap_get("weather")
19-
get(city, ...) %>% owmr_parse()
19+
get(city, ...) %>%
20+
owmr_parse() %>%
21+
owmr_class("owmr_weather")
2022
}
2123

2224
#' Find city by name or coordinates.
@@ -37,7 +39,9 @@ get_current <- function(city = NA, ...){
3739
#' find_city("London,UK")
3840
#' find_city(lat = 51.50853, lon = -0.12574, cnt = 5)
3941
#' }
40-
find_city <- function(city = NA, ...){
42+
find_city <- function(city = NA, ...) {
4143
get <- owmr_wrap_get("find")
42-
get(city, ...) %>% owmr_parse()
44+
get(city, ...) %>%
45+
owmr_parse() %>%
46+
owmr_class("owmr_find")
4347
}

R/data.R

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,15 @@
1010
#' \item{lon}{longitude}
1111
#' \item{countryCode}{two letter country code}
1212
#' }
13-
#' @source \url{http://openweathermap.org/help/city_list.txt}
13+
#' @source \url{http://bulk.openweathermap.org/sample/city.list.json.gz}
1414
#'
1515
# NOTE: UTF-8 string found in `owm_cities$nm[7053]`
1616
# Metabetchouan-Lac-a-la-Croix, needs to be fixed in case dataset
1717
# is updated
1818
"owm_cities"
19+
20+
#' List of available owm weather map layers.
21+
#'
22+
#' @seealso
23+
#' \url{https://openweathermap.org/api/weathermaps}
24+
"owm_layers"

0 commit comments

Comments
 (0)