簡體   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