【发布时间】:2017-09-04 22:06:06
【问题描述】:
我想使用 caret 包扩展我的功能 我的数据集是 train[,1:10]: 自变量 train[11]: 是我的因变量
我使用下面的代码来缩放我的 10 个自变量:
library(caret)
# calculate the pre-process parameters from the dataset
preprocessParams <- preProcess(train[,1:10], method = "range")
# transform the dataset using the parameters
train_Scaled <-predict(pp, train[,1:10])
# summarize the transformed dataset
summary(train_Scaled)
因此,我的 train_Scaled 数据框将缩放 10 个我想要的自变量,但不再具有因变量。如何将我的因变量附加到我的新 train_Scaled 数据框?谢谢!
【问题讨论】:
标签: r dataframe scaling r-caret