R/custom_period.R

Defines functions custom_period

Documented in custom_period

#' Set a custom resighting period
#'
#' @param x A dataframe generated by \code{format_bandedbirds} with columns for ResightDate and FlagID.
#' @param y A dataframe imported to R with columns for ResightDate and ResightPeriod.
#' @return Dataframe with columns for ResightPeriod and FlagID (flag colour and
#'         code).
#' @examples
#' custom_period(resight_data, resight_periods)


custom_period <- function(x, y){

  resight_data <- merge(x, y,
                        by = "ResightDate",
                        all = TRUE) # merges dataframes with flag resights by date and
                                    # survey periods by date to create dataframe of
                                    # flag resights by survey period
  resight_data$ResightDate<-NULL # removes ResightDate column

  assign("resight_data", resight_data, envir = globalenv()) # sends dataframe back to R environment

}
ajmacdonald3/bb2enchist documentation built on Nov. 5, 2019, 4:47 p.m.