diff --git a/R/nearest_stations_ogimet.R b/R/nearest_stations_ogimet.R index c722718..7b67f55 100644 --- a/R/nearest_stations_ogimet.R +++ b/R/nearest_stations_ogimet.R @@ -21,7 +21,7 @@ #' point = c(-2, 50), #' add_map = TRUE, #' no_of_stations = 60, -#' main = "Meteo stations in UK") -> a +#' main = "Meteo stations in UK") #' } #' @@ -136,7 +136,7 @@ nearest_stations_ogimet = function(country = "United+Kingdom", point = as.data.frame(t(point)) names(point) = c("lon", "lat") - distmatrix = rbind(point,result[, 3:4]) + distmatrix = rbind(point, result[, 3:4]) distance_points = stats::dist(distmatrix, method = "euclidean")[1:dim(result)[1]] result["distance"] = distance_points * 112.196672 orderd_distance = result[order(result$distance), ] diff --git a/R/ogimet_daily.R b/R/ogimet_daily.R index 165747a..9453699 100644 --- a/R/ogimet_daily.R +++ b/R/ogimet_daily.R @@ -15,11 +15,8 @@ #' @keywords internal #' #' @examples \donttest{ -#' # downloading data for Poznan-Lawica -#' poznan = ogimet_daily(station = 12330, -#' date = c("2019-01-01", "2019-03-31"), -#' coords = TRUE) -#' head(poznan) +#' ## downloading data for Poznan-Lawica +#' # poznan = ogimet_daily(station = 12330, coords = TRUE) #' } #' diff --git a/R/ogimet_hourly.R b/R/ogimet_hourly.R index 77ed141..e4f9630 100644 --- a/R/ogimet_hourly.R +++ b/R/ogimet_hourly.R @@ -16,8 +16,8 @@ #' @examples #' \donttest{ #' # downloading data for Poznan-Lawica -#' poznan = ogimet_hourly(station = 12330, coords = TRUE, precip_split = TRUE) -#' head(poznan) +#' # poznan = ogimet_hourly(station = 12330, coords = TRUE, precip_split = TRUE) +#' # head(poznan) #' } #' diff --git a/R/stations_ogimet.R b/R/stations_ogimet.R index 578929c..0ad26f7 100644 --- a/R/stations_ogimet.R +++ b/R/stations_ogimet.R @@ -12,18 +12,18 @@ #' #' @examples #' \donttest{ -#' stations_ogimet(country = "Australia", add_map = TRUE) +#' # stations_ogimet(country = "Australia", add_map = TRUE) #' } #' stations_ogimet = function(country = "United+Kingdom", date = Sys.Date(), add_map = FALSE) { #options(RCurlOptions = list(ssl.verifypeer = FALSE)) # required on windows for RCurl - if (length(country)!=1) { + if (length(country) != 1) { stop("To many country selected. Please choose one country") } - if (length(date)!=1) { + if (length(date) != 1) { stop("You can check available nearest stations for one day. Please chenge selection") } # initalizing empty data frame for storing results: @@ -44,7 +44,7 @@ stations_ogimet = function(country = "United+Kingdom", date = Sys.Date(), add_ma if (!is.na(file.size(temp)) & (file.size(temp) > 0)) { a = readLines(temp) - a = paste(a, sep="", collapse="") + a = paste(a, sep = "", collapse = "") b = strsplit(a, "Decoded synops since") @@ -114,15 +114,12 @@ if (!is.null(res)) { addfactor = ifelse(addfactor > 0.2, 0.2, addfactor) addfactor = ifelse(addfactor < 0.05, 0.05, addfactor) - graphics::plot(res$lon, res$lat, col='red', pch=19, xlab = 'longitude', ylab = 'latitude') + graphics::plot(res$lon, res$lat, col = 'red', pch = 19, xlab = 'longitude', ylab = 'latitude') graphics::text(res$lon, res$lat + addfactor, labels = res$station_names, col = 'grey70', cex = 0.6) maps::map(add = TRUE) } - + } # end of checking if res is NULL - return(res) - } - diff --git a/man/nearest_stations_ogimet.Rd b/man/nearest_stations_ogimet.Rd index 40ce9b0..331bfb5 100644 --- a/man/nearest_stations_ogimet.Rd +++ b/man/nearest_stations_ogimet.Rd @@ -41,7 +41,7 @@ The returned list is valid only for a given day. point = c(-2, 50), add_map = TRUE, no_of_stations = 60, - main = "Meteo stations in UK") -> a + main = "Meteo stations in UK") } } diff --git a/man/ogimet_daily.Rd b/man/ogimet_daily.Rd index e8d6602..6f05d73 100644 --- a/man/ogimet_daily.Rd +++ b/man/ogimet_daily.Rd @@ -26,11 +26,8 @@ The data are processed only if temperature or precipitation fields are present. } \examples{ \donttest{ - # downloading data for Poznan-Lawica - poznan = ogimet_daily(station = 12330, - date = c("2019-01-01", "2019-03-31"), - coords = TRUE) - head(poznan) + ## downloading data for Poznan-Lawica + # poznan = ogimet_daily(station = 12330, coords = TRUE) } } diff --git a/man/ogimet_hourly.Rd b/man/ogimet_hourly.Rd index 928956c..78bbd35 100644 --- a/man/ogimet_hourly.Rd +++ b/man/ogimet_hourly.Rd @@ -27,8 +27,8 @@ Downloading hourly (meteorological) data from the Synop stations available in th \examples{ \donttest{ # downloading data for Poznan-Lawica - poznan = ogimet_hourly(station = 12330, coords = TRUE, precip_split = TRUE) - head(poznan) + # poznan = ogimet_hourly(station = 12330, coords = TRUE, precip_split = TRUE) + # head(poznan) } } diff --git a/man/stations_ogimet.Rd b/man/stations_ogimet.Rd index 22a1d81..8205fb3 100644 --- a/man/stations_ogimet.Rd +++ b/man/stations_ogimet.Rd @@ -22,7 +22,7 @@ Returns a list of meteorological stations with their coordinates from the Ogimet } \examples{ \donttest{ - stations_ogimet(country = "Australia", add_map = TRUE) + # stations_ogimet(country = "Australia", add_map = TRUE) } } diff --git a/tests/testthat/test-meteo_ogimet.R b/tests/testthat/test-meteo_ogimet.R index 7495127..7805610 100644 --- a/tests/testthat/test-meteo_ogimet.R +++ b/tests/testthat/test-meteo_ogimet.R @@ -3,7 +3,7 @@ y <- 2018 test_that("meteo_ogimet works!", { - df = meteo_ogimet(interval = "daily", date = c("2019-06-01", "2019-07-08"), + df = meteo_ogimet(interval = "daily", date = c("2019-06-01", "2019-06-08"), station = c(12330, 12375), coords = TRUE) expect_true(any(colnames(df) %in% c("Lon", "Lat"))) diff --git a/vignettes/getstarted.Rmd b/vignettes/getstarted.Rmd index 941fc59..60ac315 100644 --- a/vignettes/getstarted.Rmd +++ b/vignettes/getstarted.Rmd @@ -14,7 +14,7 @@ knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) -options(scipen=999) +options(scipen = 999) ``` The goal of the **climate** R package is to automatize downloading of meteorological