如何按物种规范化 Sepal.Length 的值?
iris
Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1 5.1 3.5 1.4 0.2 setosa
...
# i have to divide by
tapply(iris$Sepal.Length, iris$Species, max)
setosa versicolor virginica
5.8 7.0 7.9
换句话说,我想将所有值Species=="setosa"
除以 5.8,依此类推,最后我希望在 Sepal.Length 列中有一个标准化值为 0..1 的数据框。
最后它应该返回
iris
Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1 0.8793103 3.5 1.4 0.2 setosa
...