3
I have a table where I need to apply a row-to-row formula to multiple columns, and the formula is:
row value - mean(all column values) / standard deviation(all column values)
is a normalization of the data to be applied in the machine Learning model.
fx <- c(6.9, 6.8, 6.7, 6.0, 6.8)
The calculation would be in this case:
6,9 - media(fx) / standard deviation(fx)... 6,8 - media(fx) / standard deviation(fx)... 6,7 - media(fx) / standard deviation(fx)...
Would anyone have any alternative to this case?
Thanks @Marcus Nunes, helped me a lot, I tried to apply in several columns of my dataset, but it didn’t work, I tried to use the function round(apply(df[6:],2,Scale)), because I want to pick up the column from the 6 until the end of the dataset, know some way I could do this?
– Roney Wesley Galan
Use
scale(df[, 6:ncol(df)])
– Marcus Nunes