Skip to content

Commit

Permalink
Fix syntax error in bfast0n and recreate the documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
GreatEmerald committed May 13, 2020
1 parent d2ec49a commit c880e6c
Show file tree
Hide file tree
Showing 22 changed files with 242 additions and 78 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ URL: http://bfast.R-Forge.R-project.org/
LazyLoad: yes
LazyData: yes
LinkingTo: Rcpp
RoxygenNote: 5.0.1
RoxygenNote: 7.1.0
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ S3method(residuals,bfast01)
export(bfast)
export(bfast01)
export(bfast01classify)
export(bfast0n)
export(bfastmonitor)
export(bfastpp)
export(bfastts)
Expand Down
10 changes: 6 additions & 4 deletions R/bfast0n.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,21 @@
#' while also being able to deal with NA values by excluding them
#' via \code{bfastpp}.
#'
#' @param ... Additional arguments to \code{\link[strucchange]{breakpoints}}.
#' @inheritParams bfastpp
#' @inheritParams strucchange::breakpoints
#' @example examples/bfast0n.r
#'
#' @export bfast0n

bfast0n <- function(data, order = 3,
bfast0n <- function(data, formula=response ~ trend + harmon, order = 3,
lag = NULL, slag = NULL, na.action = na.omit,
stl = c("none", "trend", "seasonal", "both"),
decomp=c("stlplus", "stl"), sbins=1), ...)
decomp=c("stlplus", "stl"), sbins=1, ...)
{
data_pp <- bfastpp(data, order = 3,
lag = NULL, slag = NULL, na.action = na.omit,
stl = c("none", "trend", "seasonal", "both"),
decomp=c("stlplus", "stl"), sbins=1))
return(strucchange::breakpoints(data = data_pp, ...))
decomp=c("stlplus", "stl"), sbins=1)
return(strucchange::breakpoints(formula=formula, data = data_pp, ...))
}
13 changes: 13 additions & 0 deletions examples/bfast0n.r
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
plot(simts) # stl object containing simulated NDVI time series
datats <- ts(rowSums(simts$time.series))
# sum of all the components (season,abrupt,remainder)
tsp(datats) <- tsp(simts$time.series) # assign correct time series attributes
plot(datats)

# Detect breaks
bp = bfast0n(datats)

# Default method of estimating breakpoints
bp[["breakpoints"]]
# Custom method
strucchange::breakpoints(bp, breaks=2)
10 changes: 5 additions & 5 deletions man/bfast-package.Rd

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

29 changes: 21 additions & 8 deletions man/bfast.Rd

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

32 changes: 23 additions & 9 deletions man/bfast01.Rd

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

14 changes: 9 additions & 5 deletions man/bfast01classify.Rd

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

75 changes: 75 additions & 0 deletions man/bfast0n.Rd

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

33 changes: 24 additions & 9 deletions man/bfastmonitor.Rd

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

Loading

0 comments on commit c880e6c

Please sign in to comment.