R Error in regsubsets() NA/NaN/Inf in foreign function call (arg 5) and dataset has been checked for NAs/NANs/Inf
Clash Royale CLAN TAG#URR8PPP
R Error in regsubsets() NA/NaN/Inf in foreign function call (arg 5) and dataset has been checked for NAs/NANs/Inf
FA_binary <- as.numeric(HE_Data$`FA?` == "Y")
TE_binary <- as.numeric(HE_Data$`Bond Type` == "Tax-Exempt")
ST_binary <- as.numeric(HE_Data$`School Type` == "Public")
Data <- data.table(HE_Data$School, HE_Data$`Maturity Year`, HE_Data$Cpn, HE_Data$Sprd, HE_Data$`Rating Scale (1-11)`, FA_binary, TE_binary, ST_binary)
names(Data) <- c("School", "Maturity", "Coupon", "Spread", "Rating", "FA", "Tax Status", "School Type")
year <- Data$Maturity
spread <- Data$Spread
cpn <- Data$Coupon
rating <- Data$Rating
fa <- Data$FA
schooltype <- Data$`School Type`
tax <- Data$`Tax Status`
HEsubset <- regsubsets(spread ~ year + rating + cpn + fa + schooltype + tax, data = Data)
HEsubset returns the error:
Error in leaps.setup(x, y, wt = wt, nbest = nbest, nvmax = nvmax,
force.in = force.in, : NA/NaN/Inf in foreign function call (arg 5)
In addition: Warning message: In leaps.setup(x, y, wt = wt, nbest =
nbest, nvmax = nvmax, force.in = force.in, : NAs introduced by
coercion
I have done na.omit
on the dataset and checked for nan and infinite with is.nan
and is.infinite
but keep returning the same error. Any suggestions with what is creating this error? I have successfully run similar code with a much smaller version of the same dataset (59 entries versus 1541).
na.omit
is.nan
is.infinite
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.