# The Scaling and centering Matrices

**URL:** <https://discourse.julialang.org/t/the-scaling-and-centering-matrices/50186>\
**Category:** New to Julia\
**Tags:** package, function\
**Created:** [November 15, 2020, 3:00pm UTC](https://discourse.julialang.org/t/the-scaling-and-centering-matrices/50186 "2020-11-15T15:00:55Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [November 15, 2020, 5:07pm UTC](https://discourse.julialang.org/t/the-scaling-and-centering-matrices/50186/3 "2020-11-15T17:07:13Z")

</div>

A simple analogue of R’s [`scale(A)` function](https://www.math.ucla.edu/~anderson/rw1001/library/base/html/scale.html) (with the default arguments) would be:

```julia
using LinearAlgebra, Statistics
scale(A) = mapslices(normalize!, A .- mean(A,dims=1), dims=1)

```

---

_[View the full topic](https://discourse.julialang.org/t/the-scaling-and-centering-matrices/50186)._
