Skip to content

Commit

Permalink
[BUGFIX] Refine the package based on the CRAN's feedback (#30)
Browse files Browse the repository at this point in the history
* CHG: correct the lines based on the CRAN's feedback

* CHG: increment the version number

* CHG: add cran info; reformat code
  • Loading branch information
egpivo authored Nov 13, 2023
1 parent 9142064 commit 987a596
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 9 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: SpatPCA
Title: Regularized Principal Component Analysis for Spatial Data
Version: 1.3.4
Version: 1.3.5
Authors@R: c(person(
given = "Wen-Ting",
family = "Wang",
Expand Down
1 change: 1 addition & 0 deletions R/SpatPCA.R
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ predict <-
#'
#' @param x An spatpca class object for `plot` method
#' @param ... Not used directly
#' @return `NULL`.
#' @seealso \link{spatpca}
#'
#' @export
Expand Down
4 changes: 2 additions & 2 deletions R/helper.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ scaleLocation <- function(location) {
#' @keywords internal
#' @param spatpca_object An `spatpca` class object
#' @param x_new New location matrix.
#' @return NULL
#' @return `NULL`.
#'
checkNewLocationsForSpatpcaObject <-
function(spatpca_object, x_new) {
Expand All @@ -79,7 +79,7 @@ checkNewLocationsForSpatpcaObject <-
#' @param Y Data matrix
#' @param x Location matrix.
#' @param M Number of folds for cross-validation
#' @return NULL
#' @return `NULL`.
#'
checkInputData <- function(Y, x, M) {
x <- as.matrix(x)
Expand Down
1 change: 0 additions & 1 deletion R/zzz.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
if (!identical(Sys.getenv("NOT_CRAN"), "true")) {
Sys.setenv(RCPP_PARALLEL_BACKEND = "tinythread")
}

packageStartupMessage("Welcome to SpatPCA")
}
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# SpatPCA Package

[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/SpatPCA)](https://CRAN.R-project.org/package=SpatPCA)
[![Downloads](http://cranlogs.r-pkg.org/badges/grand-total/SpatPCA)](https://CRAN.R-project.org/package=SpatPCA)
[![R build status](https://github.com/egpivo/SpatPCA/workflows/R-CMD-check/badge.svg)](https://github.com/egpivo/SpatPCA/actions)
[![Coverage Status](https://img.shields.io/codecov/c/github/egpivo/SpatPCA/master.svg)](https://app.codecov.io/github/egpivo/SpatpCA?branch=master)

Expand Down
3 changes: 3 additions & 0 deletions man/checkInputData.Rd

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

3 changes: 3 additions & 0 deletions man/checkNewLocationsForSpatpcaObject.Rd

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

3 changes: 3 additions & 0 deletions man/plot.spatpca.Rd

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

10 changes: 6 additions & 4 deletions vignettes/demo-two-dim-location.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ fill_bar <- guides(fill = guide_colourbar(
label.position = "bottom")
)
coltab <- scico(128, palette = 'vik')
color_scale_limit <- c(-.28, .28)
color_scale_limit <- c(-.8, .8)
```
#### True spatial pattern (eigenfunction)
- The underlying spatial pattern below indicates realizations will vary dramatically at the center and be almost unchanged at the both ends of the curve.
```{r, out.width = '100%'}
set.seed(1024)
p <- 30
n <- 50
p <- 25
n <- 8
location <-
matrix(rep(seq(-5, 5, length = p), 2), nrow = p, ncol = 2)
expanded_location <- expand.grid(location[, 1], location[, 2])
Expand Down Expand Up @@ -80,12 +80,13 @@ data.frame(
- The noise follows the standard normal distribution.

```{r}
realizations <- rnorm(n = n, sd = 10) %*% t(true_eigen_fn) + matrix(rnorm(n = n * p^2), n, p^2)
realizations <- rnorm(n = n, sd = 3) %*% t(true_eigen_fn) + matrix(rnorm(n = n * p^2), n, p^2)
```

#### Animate realizations
- We can see simulated central realizations change in a wide range more frequently than the others.
```{r, animation.hook="gifski", out.width = '100%'}
original_par <- par()
for (i in 1:n) {
par(mar = c(3, 3, 1, 1), family = "Times")
image.plot(
Expand All @@ -100,6 +101,7 @@ for (i in 1:n) {
legend.width=0.5
)
}
par(original_par)
```

#### Apply `SpatPCA::spatpca`
Expand Down

0 comments on commit 987a596

Please sign in to comment.