# Scale a matrix

### Description

Scale the data so each column has mean 0 and variance 1. This function is used as a pre-processing step to prep the data for analysis in all functions of the `mht`

package.

### Usage

1 |

### Arguments

`data` |
Input matrix of dimension n * p; each row is an observation vector. The intercept should be included in the first column as (1,...,1). If not, it is added. |

`warning` |
Logical value. A warning message is printed if the intercept is added. Default is TRUE. |

### Details

Scale the data so each column has mean 0 and variance 1. If we note `x`

a column of the output scaled matrix -except the first one which is the intercept, we have `sum(x)=0`

and `sum(x^2)/n=1`

.

### Value

`data` |
Scaled data. |

`intercept` |
Logical value. TRUE if the intercept was already included in the input data. |

`means.data` |
Vector of means of the input data matrix. |

`sigma.data` |
Vector of variances of the input data matrix. |

### References

Multiple hypotheses testing for variable selection; F. Rohart 2011

### Examples

1 2 3 4 5 6 7 8 | ```
## Not run:
x=matrix(rnorm(100*20),100,20)
res=data.scale(x)
x.scaled=res$data
means.x=res$means.data
sigma.x=res$sigma.data
## End(Not run)
``` |