Skip to content

Commit

Permalink
got RNAG code working - differences in column headings for files. Also
Browse files Browse the repository at this point in the history
…Fixed #7
  • Loading branch information
robbriers committed Feb 12, 2019
1 parent 8165903 commit 0ab74bc
Show file tree
Hide file tree
Showing 13 changed files with 325 additions and 25 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Generated by roxygen2: do not edit by hand

export(get_rnag)
export(get_status)
export(plot_status)
export(search_names)
Expand Down
11 changes: 4 additions & 7 deletions R/get_rnag.r
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Retrieve Reasonf for Not Achieving Good Status
#' Retrieve Reasons for Not Achieving Good Status
#' @description Retrieves details of Reasons for Not Achieving Good (RNAG)
#' status from EA Catchment Data Explorer site.
#' Data can be retrieved by specifying waterbody id
Expand Down Expand Up @@ -71,21 +71,18 @@ get_rnag <- function(col_value = NULL, column = NULL, startyr = NULL, endyr = NU
# do subsetting here - years first
if (!is.null(startyr) & !is.null(endyr)) {
# if both years are specified, subset by range
rnag_data <- rnag_data[rnag_data$Year >= startyr & rnag_data$Year <= endyr, ]
rnag_data <- rnag_data[rnag_data$Classification.Year >= startyr & rnag_data$Classification.Year <= endyr, ]
}
else if (!is.null(startyr)) {
rnag_data <- rnag_data[rnag_data$Year == startyr, ]
rnag_data <- rnag_data[rnag_data$Classification.Year == startyr, ]
}
# subset by Water.body.type
if (!is.null(type)) {
rnag_data <- rnag_data[rnag_data$Water.body.type == type, ]
}
# if year range covers 2013 and 2014, subset to just include cycle 2 data
# avoids double counting of waterbodies
rnag_data <- rnag_data[!(rnag_data$Year == 2013 & rnag_data$Cycle == 1 | rnag_data$Year == 2014 & rnag_data$Cycle == 1), ]

# remove web link column - not really needed
rnag_data <- rnag_data[, !(names(rnag_data) %in% c("classification.ID"))]
rnag_data <- rnag_data[!(rnag_data$Classification.Year == 2013 & rnag_data$Cycle == 1 | rnag_data$Classification.Year == 2014 & rnag_data$Cycle == 1), ]

return(rnag_data)
} # end of function
3 changes: 0 additions & 3 deletions R/get_status.r
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,5 @@ get_status <- function(col_value = NULL, column = NULL, level = "Overall Water B
# avoids double counting of waterbodies
status_data <- status_data[!(status_data$Year == 2013 & status_data$Cycle == 1 | status_data$Year == 2014 & status_data$Cycle == 1), ]

# remove web link column - not really needed
status_data <- status_data[, !(names(status_data) %in% c("classification.ID"))]

return(status_data)
} # end of function
6 changes: 3 additions & 3 deletions docs/index.html

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

231 changes: 231 additions & 0 deletions docs/reference/get_rnag.html

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

6 changes: 6 additions & 0 deletions docs/reference/index.html

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

Binary file modified docs/reference/plot_status-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/reference/plot_status-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/reference/plot_status-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
68 changes: 68 additions & 0 deletions man/get_rnag.Rd

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

Loading

0 comments on commit 0ab74bc

Please sign in to comment.