将kknn的摘要存储到data.frame中

时间:2015-05-15 09:35:35

标签: r dataframe

我在数据集上执行了kknn操作。我想将操作的summary转换为data.frame。以下是示例数据:

X <- data.frame(A=c(4,2,2,5,2,4), B=c("M","F","M","M","M","M"), 
                 C=c(53,50,44,47,42,43))  
n <- dim(X)[1]  
sampleValues <- sample(1:n,size=round(n/3),replace=F,prob=rep(1/n,n))  
x.train <- X[-sampleValues,]  
x.test <- X[sampleValues,]  
x.kknn <- kknn(B~., x.train, x.test, distance=1, kernel="triangular")  

是否可以将summary(x.kknn)存储在data.frame中?

0 个答案:

没有答案