在 ‘iris’ 数据集中引入 25% 的缺失值,并对 ‘Sepal.Length’ 列用 ‘mean’ 进行插补,对 ‘Petal.Length’ 列用 ‘median’ 进行插补。
Introduce 25 percent missing values in this ‘iris’ dataset and impute the ‘Sepal.Length’ column with ‘mean’ and the ‘Petal.Length’ column with ‘median.’
题目类型: 技术面试题
这是一道技术面试题,常见于澳洲IT公司面试中。
难度: easy
分类: Data Preprocessing
标签: missing-values, imputation, iris, missForest, Hmisc
参考答案摘要
答案 为了引入缺失值,我们将使用 missForest 包: 使用 prodNA 函数,我们将引入 25% 的缺失值: 为了将 ‘Sepal.Length’ 列用 ‘mean’ 插补、将 ‘Petal.Length’ 列用 ‘median’ 插补,我们将使用 Hmisc 包以及 impute 函数: library(missForest) Iris.mis<-prodNA(iris,noNA=0....
本题提供 STAR 原则详细解答和技术解析,登录匠人学院学习中心即可查看完整答案。