繁体   English   中英

错误 in.lm.fit(x, y): NA/NaN/Inf in 'x' in R

[英]Error in .lm.fit(x, y) : NA/NaN/Inf in 'x' in R

我一直试图通过以下方式使用灰盒中的关联来查找我的数据集中所有分类和数字之间的相关性 -

library(readxl)
library(timeDate)
library(greybox)
library(dplyr)
library(mice)
library(Hmisc)

carData33 <- read.csv("carData.csv")
#removing the first column since its not necessary, it represents the ID number
carData33 <- carData33[,c(2:15)]
#replacing NA with 0
carData33[is.na(carData33)] <-0

assoc(carData33)

主要目标是通过选择具有相关值的变量来进行回归。

这样做时,弹出的错误是-

Error in .lm.fit(x, y) : NA/NaN/Inf in 'x'
In addition: Warning message:
In .lm.fit(x, y) : NAs introduced by coercion

数据集如下- https://i.stack.imgur.com/ZhjwR.png

在包含分类数据的列上使用 as.factor()。 test$manufacturer <- as.factor(test$manufacturer)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM