Skip to content

Commit

Permalink
Merge pull request #142 from brews/master
Browse files Browse the repository at this point in the history
Minor code & doc fixes
  • Loading branch information
brews committed Jul 25, 2019
2 parents 936fab0 + edddc2d commit 177c7a9
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 17 deletions.
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Changes in this release:

* `composite()` now returns an empty fhx object if no composite-worthy events are found (Issue #131). Much better than throwing an obtuse error.

* Minor internal code cleanup (Issue #130, Issue #88).
* Minor internal code cleanup (Issue #130, Issue #88, Issue #133, Issue #136, Issue #88).


# burnr v0.4.0
Expand Down
5 changes: 2 additions & 3 deletions R/sea.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
#' with a single \code{series} as produced by \code{composite}
#' @param nbefore The number of lag years prior to the event year
#' @param nafter The number of lag years following the event year
#' @param event_range Logical. Constrains the time series to the time period of key events within the range
#' of the x climate series. False uses the entire climate series, ignoring the period of key events.
#' time series
#' @param event_range Logical. Constrain the time series to the time period of key events within the range
#' of the \code{x} series. FALSE uses the entire series, ignoring the period of key events.
#' @param n_iter The number of iterations for bootstrap resampling
#'
#' @details Superposed epoch analysis (SEA) helps to evaluate fire-climate
Expand Down
12 changes: 5 additions & 7 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,16 @@
#' @param year A numeric vector of observation years for each \code{series} and \code{rec_type} argument.
#' @param series A factor of series names for each \code{year} and \code{rec_type} argument.
#' @param rec_type A factor of ring types for each element in \code{year} and \code{series}.
#' @param metalist An option list of arbitrary metadata to be included in the fhx instance.
#'
#' @return An fhx instance.
#'
#' @export
fhx <- function(year, series, rec_type, metalist=list()) {
fhx <- function(year, series, rec_type) {
if (!is.numeric(year)) stop("year must be numeric")
if (!is.factor(series)) stop("series must be factor")
if (!is.list(metalist)) stop("metalist must be list")
rec_type <- make_rec_type(rec_type)
ringsdf = data.frame(year = year, series = series, rec_type = rec_type)
class(ringsdf) <- c('fhx', 'data.frame')
ringsdf <- data.frame(year = year, series = series, rec_type = rec_type)
class(ringsdf) <- c("fhx", "data.frame")
ringsdf
}

Expand Down Expand Up @@ -417,8 +415,8 @@ sort.fhx <- function(x, decreasing=FALSE, sort_by = 'first_year', ...) {
#'
#' @export
"+.fhx" <- function(a, b) {
stopifnot('fhx' %in% class(a))
stopifnot('fhx' %in% class(b))
stopifnot(is.fhx(a))
stopifnot(is.fhx(b))
f <- rbind(a, b)
check_duplicates(f)
}
Expand Down
4 changes: 1 addition & 3 deletions man/fhx.Rd

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

5 changes: 2 additions & 3 deletions man/sea.Rd

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

0 comments on commit 177c7a9

Please sign in to comment.