Skip to content

Commit

Permalink
correct mismatched length
Browse files Browse the repository at this point in the history
  • Loading branch information
pearsonca committed Nov 7, 2024
1 parent d244f20 commit f67557c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions R/internal.R
Original file line number Diff line number Diff line change
Expand Up @@ -179,14 +179,15 @@ to_function <- function(x, bounds, interp_opts) {
kind <- callargs$kind
callargs$kind <- NULL
if (kind == "integral") {
if (tail(x[[2]], 1) != 0) {
len <- length(x[[2]])
if (x[[2]][len] != 0) {
stop(sprintf(
"for integral data, the final entry should be 0; got instead: %s",
toString(tail(x[[2]], 1))
toString(x[[2]][len])
))
}
ws <- diff(x[[1]])
x[[2]] <- c(x[[2]]/ws, 0)
x[[2]] <- c(x[[2]][-len]/ws, 0)
}
}
callargs$.usekind <- NULL
Expand Down

0 comments on commit f67557c

Please sign in to comment.