Skip to content

Commit

Permalink
Update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
doccstat committed Apr 22, 2024
1 parent 53bf24d commit 225565c
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion R/fastcpd.R
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ fastcpd <- function( # nolint: cyclomatic complexity
include.mean = include_mean
)$residuals
}
} else if (family == "mean") {
} else if (family %in% c("mean", "variance", "meanvariance")) {
residuals <- matrix(NA, nrow(data), ncol(data))
segments <- c(0, cp_set, nrow(data))
for (segments_i in seq_len(length(segments) - 1)) {
Expand Down
3 changes: 2 additions & 1 deletion man/bitcoin.Rd

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

1 change: 1 addition & 0 deletions man/fastcpd_meanvariance.Rd

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

9 changes: 4 additions & 5 deletions man/transcriptome.Rd

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

3 changes: 2 additions & 1 deletion tests/testthat/examples/data-bitcoin.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
\donttest{
if (requireNamespace("ggplot2", quietly = TRUE)) {
ggplot2::ggplot(bitcoin, ggplot2::aes(x = date, y = price)) +
p <- ggplot2::ggplot(bitcoin, ggplot2::aes(x = date, y = price)) +
ggplot2::geom_line()
print(p)

result <- suppressWarnings(fastcpd.garch(
diff(log(bitcoin$price[600:900])), c(1, 1),
Expand Down
9 changes: 4 additions & 5 deletions tests/testthat/examples/data-transcriptome.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
\donttest{
if (
requireNamespace("ggplot2", quietly = TRUE) &&
requireNamespace("gridExtra", quietly = TRUE)
) {
if (requireNamespace("ggplot2", quietly = TRUE)) {
result <- fastcpd.mean(transcriptome$"10", trim = 0.005)
summary(result)
plot(result)
Expand Down Expand Up @@ -33,6 +30,8 @@ if (
}
)

gridExtra::grid.arrange(grobs = plots, ncol = 1, nrow = ncol(transcriptome))
if (requireNamespace("gridExtra", quietly = TRUE)) {
gridExtra::grid.arrange(grobs = plots, ncol = 1, nrow = ncol(transcriptome))
}
}
}
1 change: 1 addition & 0 deletions tests/testthat/examples/fastcpd_meanvariance_1.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ if (requireNamespace("mvtnorm", quietly = TRUE)) {
)
)
summary(result)
plot(result)
}

0 comments on commit 225565c

Please sign in to comment.