Skip to content

Commit

Permalink
fix handle_cdc_germany to meet R CMD check requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
EduardoFernandezC committed May 19, 2020
1 parent 5426174 commit 111acad
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 20 deletions.
23 changes: 12 additions & 11 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,22 @@ Date: 2020-05-20
Authors@R: person("Eduardo", "Fernandez C", email = "[email protected]", role = c("aut", "cre"))
Description: Chill functions for estimating chilling metrics for deciduous fruit trees. The package contains functions to use the models Utah Modified, North Carolina, Low Chill, among others. Additionally, this package contains functions to handle weather data from different data-bases in Chile and Germany, as well as functions to estimate metrics related to frost events and heat accumulation according to a modification of the Growing Degree Hour model.
Depends: R (>= 3.6)
Imports: chillR,
sp,
Imports: assertthat,
chillR,
dplyr,
tidyr,
readxl,
readr,
stringr,
XML,
tidyverse,
kableExtra,
ggplot2,
assertthat,
kableExtra,
lubridate,
patchwork,
scales
readr,
readxl,
scales,
sp,
stringi,
stringr,
tidyr,
tidyverse,
XML
License: GPL-3
Encoding: UTF-8
LazyData: true
Expand Down
20 changes: 13 additions & 7 deletions R/handle_cdc_germany.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,17 @@
#' minus 1 if \code{complete_list = FALSE}.
#'
#' @examples
#' \dontrun{
#'
#' handle_cdc_germany(action = "info_stations", variables = c("Tmin", "Tmax", "Tmean"),
#' latitude = 53.5373, longitude = 9.6397, begin = 20000101,
#' end = 20101231, number_of_stations = 25, complete_list = FALSE)
#' }
#'
#' @export handle_cdc_germany

handle_cdc_germany <- function(action, variables, latitude, longitude,
begin = 19160101, end = chillR::Date2YEARMODA(Sys.Date()),
number_of_stations = 25,
complete_list = FALSE){
begin = 19160101, end = chillR::Date2YEARMODA(Sys.Date()),
number_of_stations = 25,
complete_list = FALSE){

# Checking if action, dates and variables are valid inputs

Expand Down Expand Up @@ -94,6 +94,12 @@ handle_cdc_germany <- function(action, variables, latitude, longitude,

stations <- stations[-wrong_rows]

# Remove german characters

stations <- stringi::stri_enc_toascii(stations)

stations <- stringr::str_replace_all(stations, pattern = "\032", replacement = "ue")

# Make a dataframe of the information about the stations in Germany

stations <- data.frame(Station_name = as.character(trimws(substr(stations, 62, 100))),
Expand Down Expand Up @@ -156,7 +162,7 @@ handle_cdc_germany <- function(action, variables, latitude, longitude,
if (action == "info_stations")
return(station_in_period[c(1: number_of_stations),])


# primer dataframe to include the complete period of interest

primer <- data.frame(YEARMODA = c(begin, end),
Expand Down Expand Up @@ -272,4 +278,4 @@ handle_cdc_germany <- function(action, variables, latitude, longitude,
return(list_data[[1]])

if(action == "list_data" & complete_list == TRUE)
return(list_data) else return(list_data[-1])}
return(list_data) else return(list_data[-1])}
4 changes: 2 additions & 2 deletions man/handle_cdc_germany.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 111acad

Please sign in to comment.