I have a little problem i wanna make this formula to my code in R studio for iris (data-mean of colum)/absolute deviation. and this is my code
y=iris[,1:4]
for(i in 1:4){y[, i] = (iris[,i] - mean(iris[,i]))/sd(iris[,i])}
y
but this code is for [(data -mean each column)/standar deviasi each colum] i try to reach how the formula of [(data -mean each column)/mean absolute deviation each column] but there is a problem with this code
y=iris[,1:4]
for(i in 1:4){y[, i] = (iris[,i] - mean(iris[,i]))/meanAD(iris)}
y
i think there is no problem but it took the mad cannot be calculated.
You can do this: