【发布时间】:2015-07-22 00:55:12
【问题描述】:
我在 r 中有一个数据框,其中有一些 NA 值。如何使用 pmmlTransformations 为这些字段设置缺失值处理。我已经看到您可以在转换数据(规范化、字段映射等)时设置缺失值处理,但我想知道如何只设置缺失值而不必对数据进行规范化。
library(pmml)
library(pmmlTransformations)
df <- data.frame(id=1:5, y=1:5, x=c(2,4,3,NA,8))
dataBox <- WrapData(df)
# update the wrapped data to set x=1 when it its NA
fit <- glm(formula=y~x, data = dataBox$data)
pmml(fit, transforms=dataBox)
在此先感谢
安德鲁
【问题讨论】: