Skip to content

Commit

Permalink
Who controls the past now, controls the future
Browse files Browse the repository at this point in the history
  • Loading branch information
geryan committed Jul 9, 2024
2 parents e923126 + 5b2d01e commit cf4c1eb
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 31 deletions.
3 changes: 2 additions & 1 deletion R/standardise_rast.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
#' @export
#'
#' @examples
#' \dontrun{
#' r <- example_raster()
#'
#' standardise_rast(r)
#'
#'}
standardise_rast <- function(x){

stop("This function will shortly be removed from sdmtools\nUse terra::scale instead")
Expand Down
13 changes: 5 additions & 8 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -163,18 +163,15 @@ cov2 <- example_raster(
seed = 15.3,
layername = "cov2"
)
covs <- c(cov1, cov2)
```

`standardise_rast` — standardise a `spatRaster` by transforming it to have a mean of zero and standard deviation of one
`std_rast` — standardise a `spatRaster` by transforming it to have a range of 0—1
```{r}
cov1_st <- standardise_rast(cov1)
cov2_st <- standardise_rast(cov2)
covs <- c(cov1_st, cov2_st)
covs
cov1_st <- std_rast(cov1)
plot(covs)
plot(cov1_st)
```


Expand Down
27 changes: 6 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -430,32 +430,17 @@ cov2 <- example_raster(
seed = 15.3,
layername = "cov2"
)
```

`standardise_rast` — standardise a `spatRaster` by transforming it to
have a mean of zero and standard deviation of one

``` r
cov1_st <- standardise_rast(cov1)
cov2_st <- standardise_rast(cov2)

covs <- c(cov1_st, cov2_st)

covs
#> class : SpatRaster
#> dimensions : 10, 10, 2 (nrow, ncol, nlyr)
#> resolution : 1, 1 (x, y)
#> extent : 0, 10, 0, 10 (xmin, xmax, ymin, ymax)
#> coord. ref. :
#> source(s) : memory
#> names : cov1, cov2
#> min values : -1.038908, -0.8272874
#> max values : 4.216948, 4.9053485
covs <- c(cov1, cov2)
```

`std_rast` — standardise a `spatRaster` by transforming it to have a
range of 0—1

``` r
cov1_st <- std_rast(cov1)

plot(covs)
plot(cov1_st)
```

<img src="man/figures/README-unnamed-chunk-12-1.png" width="100%" />
Expand Down
Binary file modified man/figures/README-unnamed-chunk-12-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion man/standardise_rast.Rd

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

0 comments on commit cf4c1eb

Please sign in to comment.