Skip to content
This repository was archived by the owner on May 14, 2024. It is now read-only.

Commit

Permalink
Version 0.0.4-1
Browse files Browse the repository at this point in the history
Internal changes to use _dplyr_ 0.7.0
  • Loading branch information
adamhsparks committed Jun 12, 2017
1 parent b78fada commit 52e4dd0
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 22 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: bomrang
Type: Package
Title: Fetch Australian Government Bureau of Meteorology Data
Version: 0.0.4
Version: 0.0.4-1
Date: 2017-06-05
Authors@R: c(person("Adam", "Sparks", role = c("aut", "cre"),
email = "[email protected]"),
Expand All @@ -21,7 +21,7 @@ Depends:
Imports:
curl,
data.table,
dplyr,
dplyr (>= 0.7.0),
foreign,
httr,
magrittr,
Expand Down
6 changes: 2 additions & 4 deletions R/get_ag_bulletin.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@


#' BOM agriculture bulletin information
#'
#'Fetch the BOM agricultural bulletin information and return a tidy data frame
Expand Down Expand Up @@ -257,13 +256,12 @@ else if (state == "AUS") {

tidy_df <-
tidy_df %>%
dplyr::mutate_at(tidy_df, .funs = as.character, .vars = "time.zone") %>%
dplyr::rename(
obs_time_local = obs.time.local,
obs_time_utc = obs.time.utc,
time_zone = time.zone
) %>%
dplyr::mutate_each(dplyr::funs(as.character), obs_time_utc) %>%
dplyr::mutate_each(dplyr::funs(as.character), time_zone)
)

tidy_df <-
dplyr::select(
Expand Down
45 changes: 29 additions & 16 deletions R/get_precis_forecast.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@



#' BOM daily précis forecast
#'
#'Fetch the BOM daily précis forecast and return a tidy data frame of the daily
Expand Down Expand Up @@ -136,24 +138,26 @@ get_precis_forecast <- function(state = NULL) {

out <- tidyr::spread(out, key = attrs, value = values)
out <-
out %>%
dplyr::rename(
out,
maximum_temperature = `c("air_temperature_maximum", "Celsius")`,
minimum_temperature = `c("air_temperature_minimum", "Celsius")`,
start_time_local = `start-time-local`,
end_time_local = `end-time-local`,
start_time_utc = `start-time-utc`,
end_time_utc = `end-time-utc`
) %>%
dplyr::mutate_each(dplyr::funs(as.character), aac) %>%
dplyr::mutate_each(dplyr::funs(as.character), precipitation_range) %>%
dplyr::mutate_at(.funs = as.character,
.vars = c("aac",
"precipitation_range")) %>%
tidyr::separate(end_time_local,
into = c("end_time_local", "UTC_offset"),
sep = "\\+",) %>%
sep = "\\+") %>%
tidyr::separate(
start_time_local,
into = c("start_time_local", "UTC_offset_drop"),
sep = "\\+") %>%
sep = "\\+"
) %>%
dplyr::select(-UTC_offset_drop)

out$probability_of_precipitation <-
Expand Down Expand Up @@ -205,17 +209,26 @@ get_precis_forecast <- function(state = NULL) {
dplyr::rename(lon = LON,
lat = LAT,
elev = ELEVATION) %>%
dplyr::mutate_each(dplyr::funs(as.character), start_time_local) %>%
dplyr::mutate_each(dplyr::funs(as.character), start_time_local) %>%
dplyr::mutate_each(dplyr::funs(as.character), end_time_local) %>%
dplyr::mutate_each(dplyr::funs(as.character), start_time_utc) %>%
dplyr::mutate_each(dplyr::funs(as.character), end_time_utc) %>%
dplyr::mutate_each(dplyr::funs(as.numeric), maximum_temperature) %>%
dplyr::mutate_each(dplyr::funs(as.numeric), minimum_temperature) %>%
dplyr::mutate_each(dplyr::funs(as.numeric), lower_prec_limit) %>%
dplyr::mutate_each(dplyr::funs(as.numeric), lower_prec_limit) %>%
dplyr::mutate_each(dplyr::funs(as.character), precis) %>%
dplyr::mutate_each(dplyr::funs(as.character), probability_of_precipitation) %>%
dplyr::mutate_at(
.funs = as.character,
.vars = c(
"start_time_local",
"end_time_local",
"start_time_utc",
"end_time_utc",
"precis",
"probability_of_precipitation"
)
) %>%
dplyr::mutate_at(
.funs = as.numeric,
.vars = c(
"maximum_temperature",
"minimum_temperature",
"lower_prec_limit",
"lower_prec_limit"
)
) %>%
dplyr::rename(location = PT_NAME)

# add state field
Expand Down

0 comments on commit 52e4dd0

Please sign in to comment.