R

时间:2017-09-04 22:06:07

标签: r dataframe scaling r-caret

我想使用插入包来扩展我的功能 我的数据集是train [,1:10]:自变量 火车[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数据框?谢谢!

1 个答案:

答案 0 :(得分:0)

cbind(train_Scaled, train[,11])
相关问题