# scale

From raster v2.8-19
by Robert Hijmans

##### Scale values

Center and/or scale raster data

- Keywords
- spatial

##### Usage

```
# S4 method for Raster
scale(x, center=TRUE, scale=TRUE)
```

##### Arguments

- x
Raster* object

- center
logical or numeric. If

`TRUE`

, centering is done by subtracting the layer means (omitting`NA`

s), and if`FALSE`

, no centering is done. If`center`

is a numeric vector with length equal to the`nlayers(x)`

, then each layer of`x`

has the corresponding value from center subtracted from it.- scale
logical or numeric. If

`TRUE`

, scaling is done by dividing the (centered) layers of`x`

by their standard deviations if`center`

is`TRUE`

, and the root mean square otherwise. If scale is`FALSE`

, no scaling is done. If`scale`

is a numeric vector with length equal to`nlayers(x)`

, each layer of`x`

is divided by the corresponding value. Scaling is done after centering.

##### Value

Raster* object

##### See Also

##### Examples

```
# NOT RUN {
b <- brick(system.file("external/rlogo.grd", package="raster"))
bs <- scale(b)
# }
```

*Documentation reproduced from package raster, version 2.8-19, License: GPL (>= 3)*

### Community examples

Looks like there are no examples yet.