Skip to content

Commit

Permalink
Switched to interpolation instead of akima
Browse files Browse the repository at this point in the history
  • Loading branch information
robjhyndman committed Jan 24, 2024
1 parent 1f2bcd9 commit f8f08fa
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ Description: All functions and data sets required for the examples in the book
Hyndman (2024) "That's Weird: Anomaly Detection Using R" <https://OTexts.com/weird/>.
All packages needed to run the examples are also loaded.
Imports:
akima,
aplpack,
broom,
cli (>= 1.0.0),
Expand All @@ -23,6 +22,7 @@ Imports:
evd,
ggplot2 (>= 3.1.1),
grDevices,
interpolation,
ks,
purrr (>= 0.2.4),
rlang,
Expand Down
5 changes: 2 additions & 3 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# weird 1.0.1
# weird 1.0.2

* Removed wine_reviews dataset and created `fetch_wine_reviews()` function.
* Switched from interp to akima for bivariate interpolation due to problems on M1.
* Bug fix.
* Bug fixes.

# weird 1.0.0

Expand Down
7 changes: 2 additions & 5 deletions R/density.R
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,8 @@ density_on_grid <- function(y, fy, ngrid) {
))
# Bivariate interpolation
grid <- expand.grid(density$eval.points[[1]], density$eval.points[[2]])
density$estimate <- akima::interpp(
x = y[, 1], y = y[, 2], z = fy,
xo = grid[, 1], yo = grid[, 2]
)$z |>
suppressWarnings() |>
ifun <- interpolation::interpfun(x = y[, 1], y = y[, 2], z = fy)
density$estimate <- ifun(grid[,1], grid[,2]) |>
matrix(nrow = ngrid)
return(density)
}
Expand Down
1 change: 1 addition & 0 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Corrected errors reported at <https://cran.r-project.org/web/checks/check_results_weird.html>.
Corrected licensing issues with interpolation imports

## Test environments

Expand Down

0 comments on commit f8f08fa

Please sign in to comment.