Skip to content

Commit

Permalink
Fixed broken example with mean splice
Browse files Browse the repository at this point in the history
  • Loading branch information
marberts committed Mar 18, 2024
1 parent 4b9efd6 commit 09751d3
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: gpindex
Title: Generalized Price and Quantity Indexes
Version: 0.6.0.9011
Version: 0.6.0.9012
Authors@R: c(
person("Steve", "Martin", role = c("aut", "cre", "cph"),
email = "[email protected]",
Expand Down
2 changes: 1 addition & 1 deletion R/geks.R
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ geks_matrix <- function(index, p, q, product, n, nper, window, na.rm) {
#' offset <- length(init)
#' x <- lapply(x, \(z) rev(cumprod(rev(z))))
#' res <- numeric(offset + length(x))
#' res[seq_len(init)] <- init
#' res[seq_along(init)] <- init
#' for (i in seq_along(x)) {
#' res[i + offset] <- geometric_mean(
#' x[[i]] * res[seq(to = i + offset - 1, length.out = length(x[[i]]))]
Expand Down
2 changes: 1 addition & 1 deletion man/geks.Rd

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

7 changes: 2 additions & 5 deletions tests/Examples/gpindex-Ex.Rout.save
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ Warning in back_period(period) :
+ offset <- length(init)
+ x <- lapply(x, \(z) rev(cumprod(rev(z))))
+ res <- numeric(offset + length(x))
+ res[seq_len(init)] <- init
+ res[seq_along(init)] <- init
+ for (i in seq_along(x)) {
+ res[i + offset] <- geometric_mean(
+ x[[i]] * res[seq(to = i + offset - 1, length.out = length(x[[i]]))]
Expand All @@ -517,10 +517,7 @@ Warning in back_period(period) :
+ }
>
> mean_splice(tg[-1], cumprod(tg[[1]]))
Warning in seq_len(init) : first element used of 'length.out' argument
Warning in res[seq_len(init)] <- init :
number of items to replace is not a multiple of replacement length
[1] 1.391443 0.000000 0.000000 0.000000
[1] 1.391443 1.801142 2.228836 2.688842
>
> #---- Missing data ----
>
Expand Down

0 comments on commit 09751d3

Please sign in to comment.