Skip to content

Commit a0c03ca

Browse files
committed
Merge branch 'develop'
2 parents 44640d9 + b031e8f commit a0c03ca

19 files changed

+108
-62
lines changed

DESCRIPTION

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
Package: owmr
22
Title: OpenWeatherMap API Wrapper
3-
Version: 0.7.0
3+
Version: 0.7.2
44
Authors@R: person("Stefan", "Kuethe", email = "crazycapivara@gmail.com", role = c("aut", "cre"))
5-
Description: An R Interface to OpenWeatherMap.
6-
Beside functions for fetching weather data from owm, owmr supplies
5+
Description: Accesses OpenWeatherMap's (owm) <https://openweathermap.org/> API.
6+
'owm' itself is a service providing weather data in the past, in the future and now.
7+
Furthermore, 'owm' serves weather map layers usable in frameworks like 'leaflet'.
8+
In order to access the API, you need to sign up for an API key. There are free and paid plans.
9+
Beside functions for fetching weather data from 'owm', 'owmr' supplies
710
tools to tidy up fetched data (for fast and simple access) and to show it on leaflet maps.
811
URL:
912
https://github.com/crazycapivara/owmr/,

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
YEAR: 2016-2017
2-
COPYRIGHT HOLDER: Stefan Kuethe, Kassel
2+
COPYRIGHT HOLDER: Stefan Kuethe

NEWS.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,11 @@
2727

2828
* Added functions to add owm tiles to leaflet map.
2929
- Note: Performance of owm tile server seems to be low.
30+
31+
# owmr 0.7.1
32+
33+
* Fixed false poitives in check for undefined global variable `.` from `magrittr`
34+
35+
# owmr 0.7.2
36+
37+
* Updated package description

R/package.R

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
#' owmr - An R interface to OpenWeatherMap
1+
#' owmr - An R interface to access OpenWeatherMap's API
2+
#'
3+
#' In order to access the API, you need to sign up for an API key
4+
#' at \url{https://openweathermap.org/}. \cr
5+
#' For optional parameters (\code{...}) in functions see
6+
#' \url{https://openweathermap.org/api/}
27
#'
38
#' @name owmr
49
#'

R/tidy_up-parse_columns.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#' @examples\dontrun{
1010
#' parse_dt <- function(x){as.POSIXct(x, origin = "1970-01-01")}
1111
#' forecast <- get_forecast("Kassel")$list
12-
#' forecast %<>% parse_result(list(dt = parse_dt))
12+
#' forecast %<>% parse_columns(list(dt = parse_dt))
1313
#' }
1414
parse_columns <- function(data, functions_){
1515
for(name in names(functions_)){

R/tidy_up-remove_prefix.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#' @examples
1111
#' x <- data.frame(main.temp = 1:10, sys.msg = "OK", cnt = 10:1)
1212
#' names(x)
13-
#' remove_prefix(x, c("main", "sys")) %>% names
13+
#' remove_prefix(x, c("main", "sys")) %>% names()
1414
remove_prefix <- function(data, prefices, sep = "."){
1515
for(prefix in prefices){
1616
prefix <- paste0(prefix, sep)

R/tidy_up-use_underscore.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#'
88
#' @examples
99
#' names(airquality)
10-
#' use_underscore(airquality) %>% names
10+
#' use_underscore(airquality) %>% names()
1111
use_underscore <-function(data){
1212
names(data) <- gsub("\\.", "_", names(data))
1313
data

R/zzz.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
.onAttach <- function(libname, pkgname){
22
packageStartupMessage(
33
pkgname, " ", getNamespaceVersion(pkgname), "\n",
4-
" another crazy way to talk to OpenWeatherMap's api\n",
4+
" another crazy way to talk to OpenWeatherMap's API\n",
55
" Documentation: type ?owmr or https://crazycapivara.github.io/owmr/\n",
66
" Issues, notes and bleeding edge: https://github.com/crazycapivara/owmr/\n"
77
)
88
}
9+
10+
globalVariables(".")

README.md

Lines changed: 39 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1-
OpenWeatherMap Api Wrapper for R
1+
An R Interface to OpenWeatherMap
22
================
33

4+
[![CRAN\_Status\_Badge](https://www.r-pkg.org/badges/version/owmr)](https://cran.r-project.org/package=owmr)
5+
6+
`owmr` accesses **OpenWeatherMap's** API, a service providing weather data in the past, in the future and now and furthermore, serving weather map layers usable in frameworks like `leaflet`. In order to access its API you have to sign up for an API key at
7+
8+
- <https://openweathermap.org>
9+
410
Builds
511
------
612

@@ -25,21 +31,22 @@ install_github("crazycapivara/owmr")
2531
install_github("crazycapivara/owmr", ref = "develop")
2632
```
2733

28-
Current version
29-
---------------
34+
Introduction
35+
------------
36+
37+
See **OpenWeatherMap's** API documentation for optional parameters, which can be passed to all functions fetching weather data via the `...` parameter in R
38+
39+
- <https://openweathermap.org/api/>
3040

3141
``` r
3242
library(owmr)
3343
```
3444

35-
## owmr 0.7.0
36-
## another crazy way to talk to OpenWeatherMap's api
45+
## owmr 0.7.2
46+
## another crazy way to talk to OpenWeatherMap's API
3747
## Documentation: type ?owmr or https://crazycapivara.github.io/owmr/
3848
## Issues, notes and bleeding edge: https://github.com/crazycapivara/owmr/
3949

40-
Introduction
41-
------------
42-
4350
``` r
4451
# pass api key
4552
api_key_ = "your-api-key"
@@ -71,10 +78,10 @@ res[c("coord.lon", "coord.lat", "main.temp", "weather.description")]
7178
## [1] 51.51
7279
##
7380
## $main.temp
74-
## [1] 6.92
81+
## [1] 4.01
7582
##
7683
## $weather.description
77-
## [1] "broken clouds"
84+
## [1] "moderate rain"
7885

7986
``` r
8087
# ... by city id
@@ -106,13 +113,13 @@ get_current(rio$id, units = "metric") %>%
106113
## [1] "Rio de Janeiro"
107114
##
108115
## $main.temp
109-
## [1] 33.98
116+
## [1] 28.73
110117
##
111118
## $main.humidity
112-
## [1] 56
119+
## [1] 70
113120
##
114121
## $wind.speed
115-
## [1] 6.7
122+
## [1] 2.6
116123

117124
``` r
118125
# get weather data from stations
@@ -121,13 +128,13 @@ find_stations_by_geo_point(lat = 51.31667, lon = 9.5, cnt = 7) %>%
121128
```
122129

123130
## distance station.id station.name last.main.temp
124-
## 1 13.276 4926 EDVK 273.15
125-
## 2 26.926 4954 ETHF 273.15
131+
## 1 13.276 4926 EDVK 274.15
132+
## 2 26.926 4954 ETHF 276.15
126133
## 3 69.579 4910 EDLP 275.15
127-
## 4 89.149 73733 Uwe Kruse 274.85
128-
## 5 93.344 1460732694 hlw31 273.15
134+
## 4 89.149 73733 Uwe Kruse 275.55
135+
## 5 93.344 1460732694 hlw31 275.43
129136
## 6 97.934 1442728908 AmiH 273.15
130-
## 7 98.978 4951 ETHB 275.15
137+
## 7 98.978 4951 ETHB 276.15
131138

132139
``` r
133140
# get forecast
@@ -145,7 +152,7 @@ names(forecast)
145152
cnt = forecast$cnt) %>% cat()
146153
```
147154

148-
## name: London, id: 2643743, (forcast) rows: 40
155+
## name: London, id: 2643743, (forcast) rows: 35
149156

150157
``` r
151158
names(forecast$list)
@@ -164,12 +171,12 @@ forecast$list[c("dt_txt", "main.temp", "main.temp_max", "wind.speed")] %>%
164171
```
165172

166173
## dt_txt main.temp main.temp_max wind.speed
167-
## 1 2017-01-10 21:00:00 6.17 6.17 3.33
168-
## 2 2017-01-11 00:00:00 6.38 6.38 3.31
169-
## 3 2017-01-11 03:00:00 6.05 6.05 4.08
170-
## 4 2017-01-11 06:00:00 7.51 7.51 5.57
171-
## 5 2017-01-11 09:00:00 9.12 9.12 6.25
172-
## 6 2017-01-11 12:00:00 8.60 8.60 7.17
174+
## 1 2017-01-14 15:00:00 4.74 5.04 4.81
175+
## 2 2017-01-14 18:00:00 3.38 3.60 3.65
176+
## 3 2017-01-14 21:00:00 3.38 3.52 3.97
177+
## 4 2017-01-15 00:00:00 0.71 0.78 4.67
178+
## 5 2017-01-15 03:00:00 -0.39 -0.39 3.95
179+
## 6 2017-01-15 06:00:00 -0.55 -0.55 2.97
173180

174181
``` r
175182
# flatten weather column and tidy up column names
@@ -190,15 +197,15 @@ names(forecast$list)
190197
forecast$list %<>% parse_columns(list(temp = round, wind_speed = round))
191198

192199
# do some templating ...
193-
("{{dt_txt}}h {{temp}} °C, {{wind_speed}} m/s" %$$%
200+
("{{dt_txt}}h {{temp}}°C, {{wind_speed}} m/s" %$$%
194201
forecast$list) %>% head(10)
195202
```
196203

197-
## [1] "2017-01-10 21:00:00h 6 °C, 3 m/s" "2017-01-11 00:00:00h 6 °C, 3 m/s"
198-
## [3] "2017-01-11 03:00:00h 6 °C, 4 m/s" "2017-01-11 06:00:00h 8 °C, 6 m/s"
199-
## [5] "2017-01-11 09:00:00h 9 °C, 6 m/s" "2017-01-11 12:00:00h 9 °C, 7 m/s"
200-
## [7] "2017-01-11 15:00:00h 8 °C, 7 m/s" "2017-01-11 18:00:00h 7 °C, 6 m/s"
201-
## [9] "2017-01-11 21:00:00h 6 °C, 6 m/s" "2017-01-12 00:00:00h 6 °C, 6 m/s"
204+
## [1] "2017-01-14 15:00:00h 5°C, 5 m/s" "2017-01-14 18:00:00h 3°C, 4 m/s"
205+
## [3] "2017-01-14 21:00:00h 3°C, 4 m/s" "2017-01-15 00:00:00h 1°C, 5 m/s"
206+
## [5] "2017-01-15 03:00:00h 0°C, 4 m/s" "2017-01-15 06:00:00h -1°C, 3 m/s"
207+
## [7] "2017-01-15 09:00:00h 1°C, 3 m/s" "2017-01-15 12:00:00h 3°C, 3 m/s"
208+
## [9] "2017-01-15 15:00:00h 6°C, 5 m/s" "2017-01-15 18:00:00h 7°C, 4 m/s"
202209

203210
Documentation
204211
-------------
@@ -226,6 +233,6 @@ test_dir("tests/testthat/")
226233
## parse columns: ..
227234
## render operator: ...
228235
## current weather data from multiple stations: ...
229-
## tidy up data: ...
236+
## tidy up data: ....
230237
##
231238
## DONE ======================================================================

README.rmd

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: "OpenWeatherMap Api Wrapper for R"
2+
title: "An R Interface to OpenWeatherMap"
33
output: github_document
44
---
55

@@ -10,6 +10,12 @@ library(magrittr)
1010
source("tmp/settings.R")
1111
```
1212

13+
[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/owmr)](https://cran.r-project.org/package=owmr)
14+
15+
`owmr` accesses __OpenWeatherMap's__ API, a service providing weather data in the past, in the future and now and furthermore, serving weather map layers usable in frameworks like `leaflet`. In order to access its API you have to sign up for an API key at
16+
17+
* https://openweathermap.org
18+
1319
## Builds
1420

1521
__master__
@@ -26,21 +32,24 @@ __develop__
2632
require("devtools")
2733
2834
# stable
29-
install_github("crazycapivara/owmr")
35+
install.packages("owmr")
36+
37+
# unstable
38+
install_github("crazycapivara/owmr/")
3039
3140
# bleeding edge
32-
install_github("crazycapivara/owmr", ref = "develop")
41+
install_github("crazycapivara/owmr/", ref = "develop")
3342
```
3443

35-
## Current version
44+
## Introduction
3645

37-
```{r version, echo=TRUE, eval=TRUE}
38-
library(owmr)
39-
```
46+
See __OpenWeatherMap's__ API documentation for optional parameters, which can be passed to all functions fetching weather data via the `...` parameter in R
4047

41-
## Introduction
48+
* https://openweathermap.org/api/
4249

4350
```{r introduction, echo=TRUE, eval=TRUE}
51+
library(owmr)
52+
4453
# pass api key
4554
api_key_ = "your-api-key"
4655
owmr_settings(api_key = api_key)
@@ -84,7 +93,7 @@ names(forecast$list)
8493
forecast$list %<>% parse_columns(list(temp = round, wind_speed = round))
8594
8695
# do some templating ...
87-
("{{dt_txt}}h {{temp}} °C, {{wind_speed}} m/s" %$$%
96+
("{{dt_txt}}h {{temp}}°C, {{wind_speed}} m/s" %$$%
8897
forecast$list) %>% head(10)
8998
```
9099

0 commit comments

Comments
 (0)