as.integer(vector)更改向量,即使它只包含四舍五入值(在r中)
为什么当我在r中变换0和1的向量时,它会使向量变形并改变其值 表(预测) as.integer(预测)as.integer(vector)更改向量,即使它只包含四舍五入值(在r中),r,R,为什么当我在r中变换0和1的向量时,它会使向量变形并改变其值 表(预测) as.integer(预测) 我认为预测是一个因素: > Prediction <- factor(c(0, 0, 1, 1)) > table(Prediction) Prediction 0 1 2 2 > as.integer(Prediction) [1] 1 1 2 2 我认为预测是一个因素: > Prediction <- factor(c(0, 0, 1, 1)) &
我认为预测是一个因素:
> Prediction <- factor(c(0, 0, 1, 1))
> table(Prediction)
Prediction
0 1
2 2
> as.integer(Prediction)
[1] 1 1 2 2
我认为预测是一个因素:
> Prediction <- factor(c(0, 0, 1, 1))
> table(Prediction)
Prediction
0 1
2 2
> as.integer(Prediction)
[1] 1 1 2 2
我的猜测是,?因子
中的“警告”部分与此相关<代码>x我猜系数中的“警告”部分与此相关<代码>x“R-地狱”FTW!第8.2.1章“R-地狱”FTW!第8.2.1章
> Prediction <- factor(c(0, 0, 1, 1))
> table(Prediction)
Prediction
0 1
2 2
> as.integer(Prediction)
[1] 1 1 2 2
> as.integer(as.character(Prediction))
[1] 0 0 1 1