From 848240fea73608fb54b673cf395db9bc38097e73 Mon Sep 17 00:00:00 2001 From: Brewster Malevich Date: Wed, 7 Aug 2019 13:31:55 -0700 Subject: [PATCH 1/2] Fix minor error in docs, close #153 --- R/sea.R | 12 ++++++------ man/sea.Rd | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/R/sea.R b/R/sea.R index 6851733..d0daf08 100644 --- a/R/sea.R +++ b/R/sea.R @@ -44,12 +44,12 @@ #' #' @return A `sea` object containing. This contains: #' * "event_years": a numeric vector of event years. -#' * "actual": a `data.frame` summary of the actual events composite. -#' * "simulated": a `data.frame` summary of the simulated events composite. -#' * "departure": a `data.frame` summary of the departures of "actual" from -#' "simulated" events. -#' * "simulated": a 2D `matrix` of the bootstrapped-values across lags. -#' * "observed": a 2D `matrix` of "actual" events and their lags. +#' * "actual": a `data.frame` summary of the actual events. +#' * "random": a `data.frame` summary of the bootstrapped events. +#' * "departure": a `data.frame` summary of the departures of actual from +#' bootstrapped events. +#' * "simulated": a full 2D `matrix` of the bootstrapped-values across lags. +#' * "observed": a ful 2D `matrix` of "actual" events across lags. #' #' @seealso #' * [plot_sealags()] plots `sea` lags and their statistical significance. diff --git a/man/sea.Rd b/man/sea.Rd index 129fb7b..9da68e3 100644 --- a/man/sea.Rd +++ b/man/sea.Rd @@ -29,12 +29,12 @@ series, ignoring the period of key events.} A \code{sea} object containing. This contains: \itemize{ \item "event_years": a numeric vector of event years. -\item "actual": a \code{data.frame} summary of the actual events composite. -\item "simulated": a \code{data.frame} summary of the simulated events composite. -\item "departure": a \code{data.frame} summary of the departures of "actual" from -"simulated" events. -\item "simulated": a 2D \code{matrix} of the bootstrapped-values across lags. -\item "observed": a 2D \code{matrix} of "actual" events and their lags. +\item "actual": a \code{data.frame} summary of the actual events. +\item "random": a \code{data.frame} summary of the bootstrapped events. +\item "departure": a \code{data.frame} summary of the departures of actual from +bootstrapped events. +\item "simulated": a full 2D \code{matrix} of the bootstrapped-values across lags. +\item "observed": a ful 2D \code{matrix} of "actual" events across lags. } } \description{ From ce6897614c19e577780e111c92681fdd97e2097f Mon Sep 17 00:00:00 2001 From: Brewster Malevich Date: Wed, 7 Aug 2019 14:02:11 -0700 Subject: [PATCH 2/2] yearly_recording doest return factors, close #154 --- NEWS.md | 2 ++ R/utils.R | 14 ++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/NEWS.md b/NEWS.md index dc549c8..0403dc6 100644 --- a/NEWS.md +++ b/NEWS.md @@ -18,6 +18,8 @@ Changes in this release: * Updated in-package citation information (`citation("burnr")`). Please cite burnr if you use it in your work! +* `yearly_recording()` now returns a data frame with a numeric "year" column (Issue #154). In past versions, the "year" column contained factors. + * Added unit tests for basic plotting function options. We now have test coverage for more than 75% of our code. * Minor internal code cleanup (Issue #130, Issue #88, Issue #133, Issue #136, Issue #88, Issue #146) and code linting. diff --git a/R/utils.R b/R/utils.R index f4a02ba..f2bd72b 100644 --- a/R/utils.R +++ b/R/utils.R @@ -455,10 +455,16 @@ count_event_position <- function(x, injury_event = FALSE, position, groupby) { #' #' @export yearly_recording <- function(x, injury_event = FALSE) { - as.data.frame(table(year = plyr::ddply(x, "series", - find_recording, - injury_event = injury_event - )$recording)) + out <- as.data.frame( + table( + year = plyr::ddply(x, "series", find_recording, + injury_event = injury_event + )$recording + ), + stringsAsFactors=FALSE + ) + out$year <- as.numeric(out$year) + out }