Skip to content

Commit

Permalink
Replace data with df
Browse files Browse the repository at this point in the history
  • Loading branch information
damianooldoni committed Mar 27, 2023
1 parent 94ec160 commit 93b3b43
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions R/indicator_native_range_year.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#' Based on
#' [countYearProvince](https://github.com/inbo/reporting-rshiny-grofwildjacht/blob/exoten/reporting-grofwild/R/countYearProvince.R)
#' plot from reporting - rshiny - grofwildjacht
#' @param data input data.frame.
#' @param df input data.frame.
#' @param years (numeric) vector years we are interested to. If \code{NULL}
#' (default) all years from minimum and maximum of years of first observation
#' are taken into account.
Expand All @@ -29,7 +29,7 @@
#' @export
#' @importFrom dplyr %>% .data

indicator_native_range_year <- function(data, years = NULL,
indicator_native_range_year <- function(df, years = NULL,
type = c("native_continent", "native_range"),
x_lab = "year",
y_lab = "alien species",
Expand All @@ -38,15 +38,15 @@ indicator_native_range_year <- function(data, years = NULL,
type <- match.arg(type)

# Rename to default column name
data <-
data %>%
df <-
df %>%
dplyr::rename_at(dplyr::vars(first_observed), ~"first_observed")

if (is.null(years)) {
years <- sort(unique(data$first_observed))
years <- sort(unique(df$first_observed))
}

plotData <- data
plotData <- df

plotData$location <- switch(type,
native_range = plotData$native_range,
Expand Down
4 changes: 2 additions & 2 deletions man/indicator_native_range_year.Rd

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

0 comments on commit 93b3b43

Please sign in to comment.