【发布时间】:2019-09-27 06:53:39
【问题描述】:
在数据框中,我想将每个值除以列值的标准差的平方根(~ Pareto Scaling)。我已从现有包中获取代码 (https://github.com/cran/RFmarkerDetector/blob/master/R/scaling.R)
paretoscale <- function(data) {
# Here we perform centering
x.centered <- apply(x, 2, function(x) x - mean(x))
# Then we perform scaling on the mean-centered matrix
x.sc <- apply(x.centered, 2, function(x) x/sqrt(sd(x)))
x.sc <- cbind(sample_classes, x.sc)
x.centered <- apply(x, 2, function(x) x - mean(x) 是不是应该像 x - mean(column where x is) 那样做?你能解释一下它是如何工作的吗?
【问题讨论】: