Skip to content

Commit

Permalink
cran submission
Browse files Browse the repository at this point in the history
ready for cran submission
  • Loading branch information
ilapros committed Aug 9, 2022
1 parent 4d7a4af commit 37075cb
Show file tree
Hide file tree
Showing 30 changed files with 2,619 additions and 2,119 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ README.Rmd
^docs$
^doc$
^pkgdown$
cran-comments.md
5 changes: 2 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: rnrfa
Title: UK National River Flow Archive Data from R
Version: 2.0.5-2
Version: 2.0.6
Authors@R: c(person("Ilaria", "Prosdocimi",
email = "prosdocimi.ilaria@gmail.com",
role = c("ctb", "cre"),
Expand Down Expand Up @@ -54,9 +54,8 @@ Suggests:
covr,
lintr,
rmarkdown
LazyData: true
Encoding: UTF-8
License: GPL-3
Repository: CRAN
RoxygenNote: 7.1.2
RoxygenNote: 7.2.1
VignetteBuilder: knitr
3 changes: 2 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
v2.0.5
v2.0.6 and submitted to CRAN
--------------------------------------
Major changes:

- Change of maintainer for CRAN package
- The hard dependency on the rgdal package is dropped (this is in light of the announced retirement of rgdal in 2023). In the process the hard dependence to sp has been dropped in favour of sf, to avoid possible issues down the line when sp goes through the changes necessary to accommodate the rgdal retirement. The package still depends on sp via ggmap -> RgoogleMaps.

Minor changes:
Expand Down
8 changes: 4 additions & 4 deletions R/catalogue.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ catalogue <- function(bbox = NULL, column_name = NULL, column_value = NULL,
}

# FILTER BASED ON METADATA STRINGS/THRESHOLD
if (is.null(column_name) & !is.null(column_value)) {
if (is.null(column_name) && !is.null(column_value)) {
stop("Enter valid column_name")
}
if (!is.null(column_name) & is.null(column_value)) {
if (!is.null(column_name) && is.null(column_value)) {
stop("Enter valid column_value")
}
if (!is.null(column_name) & !is.null(column_value)) {
if (!is.null(column_name) && !is.null(column_value)) {
my_column <- unlist(eval(parse(text = paste0("df$`", column_name, "`"))))
# The column contains numbers
condition_1 <- is.numeric(my_column)
Expand All @@ -96,7 +96,7 @@ catalogue <- function(bbox = NULL, column_name = NULL, column_value = NULL,
condition_2 <- substr(column_value, 1, 1) == ">"
condition_3 <- substr(column_value, 1, 1) == "<"
condition_4 <- substr(column_value, 1, 1) == "="
if (condition_2 | condition_3 | condition_4) {
if (condition_2 || condition_3 || condition_4) {
if (substr(column_value, 2, 2) == "=") {
threshold <- as.numeric(as.character(substr(column_value, 3,
nchar(column_value))))
Expand Down
18 changes: 9 additions & 9 deletions R/osg_parse.R
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,6 @@ osg_parse <- function(grid_refs, coord_system = c("BNG", "WGS84")) {
return(as.list(xy))
}



.transform_crs <- function(x, y, from, to) {

df <- data.frame(x = as.numeric(x), y = as.numeric(y), from = from, to = to)
Expand All @@ -118,19 +116,21 @@ osg_parse <- function(grid_refs, coord_system = c("BNG", "WGS84")) {

# nothing to do ...
if (from == to) return(xy)
#
#
# drop dependency on sp, include dependency on sf
# this is due to the retiremnt of some packages
# this is due to the retirement of some packages
# https://r-spatial.org/r/2022/04/12/evolution.html#packages-depending-on-sp-and-raster
# sp::coordinates(xy) <- ~x + y
# sp::proj4string(xy) <- sp::CRS(paste0("+init=epsg:", from))
#
#
# xy_new <- sp::spTransform(xy, sp::CRS(paste0("+init=epsg:", to)))
#
#
# as.data.frame(sp::coordinates(xy_new))
if(nrow(xy) == 1) pointxy <- sf::st_sfc(sf::st_point(as.matrix(xy)), crs = from)
if(nrow(xy) > 1) pointxy <- sf::st_sfc(sf::st_multipoint(as.matrix(xy)), crs = from)
xy_new <- sf::st_transform(pointxy,crs = sf::st_crs(to))
if(nrow(xy) == 1) pointxy <- sf::st_sfc(sf::st_point(as.matrix(xy)),
crs = from)
if(nrow(xy) > 1) pointxy <- sf::st_sfc(sf::st_multipoint(as.matrix(xy)),
crs = from)
xy_new <- sf::st_transform(pointxy, crs = sf::st_crs(to))
xy_new <- sf::st_coordinates(xy_new)[,c("X","Y"), drop = FALSE]
colnames(xy_new) <- c("x", "y"); rownames(xy_new) <- rn
as.data.frame(xy_new)
Expand Down
10 changes: 5 additions & 5 deletions R/plot_rain_flow.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ plot_rain_flow <- function(id = NULL,

converted_flow <- convert_flow(flow, area)

proportion <- ceiling((max(converted_flow, na.rm = T) -
min(converted_flow, na.rm = T)) / 3)
proportion <- ceiling((max(converted_flow, na.rm = TRUE) -
min(converted_flow, na.rm = TRUE)) / 3)

graphics::par(mar = c(4, 4, 4, 4))

Expand All @@ -51,10 +51,10 @@ plot_rain_flow <- function(id = NULL,
main = title, xlab = "", ylab = "Flow [mm/d]")

# Add precipitation to the top
graphics::par(bty = "n", new = T)
graphics::par(bty = "n", new = TRUE)
graphics::plot(rain, type = "h", main = "",
ylim = rev(range(rain) * 5), # downward bars
yaxt = "n", xaxt = "n", ann = F, # do not plot x and y axis
yaxt = "n", xaxt = "n", ann = FALSE, # do not plot x and y axis
auto.grid = FALSE, minor.ticks = FALSE,
col = "deepskyblue3") # suggested cosmetics

Expand All @@ -66,7 +66,7 @@ plot_rain_flow <- function(id = NULL,
cex = graphics::par("cex.lab"),
col = "deepskyblue3", adj = 1)
# reset border and overlay
graphics::par(bty = "o", new = F)
graphics::par(bty = "o", new = FALSE)

graphics::legend("bottom",
c("GDF", "CMR"),
Expand Down
2 changes: 1 addition & 1 deletion R/seasonal_averages.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ seasonal_averages <- function(timeseries, season = "Spring") {
message("Please, enter valid time series.")
stop

}else{
}else {

tslist <- lapply(X = as.list(timeseries), FUN = seasonal_averages_internal,
season)
Expand Down
13 changes: 13 additions & 0 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Comment to Cran
This is the first submission of a new maintainer for the package - see Claudia Vitolo's email on August 5th.

R CMD --as-cran only gives a NOTE on the change on maintainer

Tested via rhub on
Windows Server 2022, R-devel, 64 bit
Ubuntu Linux 20.04.1 LTS, R-devel, GCC
Ubuntu Linux 20.04.1 LTS, R-release, GCC
Fedora Linux, R-devel, clang, gfortran
macOS 10.13.6 High Sierra, R-release, brew
macOS 10.13.6 High Sierra, R-release, CRAN setup

7 changes: 3 additions & 4 deletions docs/404.html

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

179 changes: 89 additions & 90 deletions docs/articles/index.html

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

Loading

0 comments on commit 37075cb

Please sign in to comment.