Added on -2019-09-18

| 1 pages

| 135 words

| 165 views

Trusted by 2+ million users,

1000+ happy students everyday

This R code is trying to scale the matrix and transform all the values of the matrix in standardised values. The formula for normalising the value is (x - mean)/sdwhere x = value of the particular elementmean = mean of each columnsd = standard deviation of the column#creating a matrix with 3 columns and 3 rowsmatrix_1 = matrix(seq(1,12),ncol=4,nrow=3,byrow=TRUE)matrix_1#calling function matrix_scalem_scl <- matrix_scale(matrix_1)m_scl#function to scale values of matrixmatrix_scale <- function(x) sweep(sweep(x, 2, colMeans(x)), 2, apply(x, 2, sd), '/')

** You are reading a preview**

Upload your documents to download

or

Become a Desklib member to get accesss

Paid Plans

Free Plan

Single Unlock

Monthly Plan

Yearly Plan