This is the error:
Error in eval(predvars, data, env) :
object '.data_Holand.Netherlands' not found
This is my code when I run it:
rf2<-randomForest(income~., data = income_df_train2, importance= TRUE)
income_df_test2$.data_.Holand.Netherlands<-rep(0, times = nrow(income_df_test2))
predicted<-predict(rf2, newdata = income_df_test2, type = "prob") ####This line does not work need to check why
ID<-income_df_test$Id
I already ran this model previously using training data, now I am running it against the test data to produce a csv file with the results.
Please take the time to understand and investigate error messages before posting. The error says .data_Holand.Netherlands was not found. This means it does not exist in the testing dataframe. And it does not. You have created the column .data_.Holand.Netherlands instead of .data_Holand.Netherlands.
Related
The error:
"Error: Can't convert labels <double[,1]> to match type of x . Cannot decrease dimensions."
I can't provide a reproducible example because the data is housed in a virtual server, and I don't know what are the properties causing this error. This is a model obtained from geeglm(), and this error happens when I use summary() on the model.
I've tried removing labels, coercing the data object to a data frame object, but the error persists.
I am new to R and to actually asking a question in Stack Overflow. I looked at several similar questions, but they did not seem to apply to help my situation. I am trying to make a linear model with the lm() function, but I get an error returned that states one of my data frame columns is able to be found:
library(SemiPar) # Contains Janka data
data(janka)
names(janka) <- c("Density", "Hardness")
janka.ls1 <- lm(hardness~dens, Data = janka)
I get the following error after running the final line:
Error in eval(predvars, data, env) : object 'Hardness' not found
As you can see, I named one of the two columns 'Hardness' and when I view the data I also see that the names do match. Further, when I try running the code using the original data column name, it still has the same issue.
Thanks for your help!!
I am having trouble getting the pairs() function to work in nlme. Take this example from Pinhiero and Bates Mixed-Effects Models in S and S-Plus.
The model itself runs just fine
fm1Theo.lis <- nlsList(conc ~ SSfol(Dose, Time, lKe, lKa, lCl), data = Theoph)
But the pairs plot...
pairs(fm1Theo.lis, id = 0.1)
...returns this error
Error in as.data.frame.default(x) :
cannot coerce class "c("nlsList", "lmList")" to a data.frame
I also tried
pairs(fm1Theo.lis, ~ ranef(., level = 2), id = 0.1)
But get the same error. Any ideas?
Here's how one may think in this case. The error
Error in as.data.frame.default(x) :
cannot coerce class ‘c("nlsList", "lmList")’ to a data.frame
says that some object of class c("nlsList", "lmList") is being coerced to a data frame. Now since fm1Theo.lis is the result of using nlsList, it seems that the object in the error is indeed nlsList. That means that pairs does not know what to do with objects of such class. To confirm this, we can run
pairs.default(fm1Theo.lis, id = 0.1)
which is what is going to happen when no specific method for fm1Theo.lis is found. Indeed the error is the same. In one way or another confirming that nlsList and comes from nlme, it becomes clear that the issue is with loading the nlme package. Loading it or restarting the session then is almost surely going to help.
I am trying to feed a hierarchical model with the lmer function from the lme4 package but lattely while trying new dataset for my code I encountered an error that occurs when the chol function is called from the monadicbase function:
"Debug location is approximate because source code is not available"
chol.default <- function(x, pivot = FALSE, LINPACK = FALSE, tol = -1, ...)
{
if (is.complex(x))
stop("complex matrices not permitted at present")
.Internal(La_chol(as.matrix(x), pivot, tol))
}
By searching within the lmer code on Github, I figured out that the chol function is called from the checkConv function within the package lme4.
My problem is that I do not understand why I get this message all the time with a specific dataset. Clearly, when I get the result at the end, it is incorrect and I don't know how to step inside the lmer code to start debugging that issue since I do not find the same arborescence at all inside my downloaded package and can't find where the used code is.
I sadly do not have a reproducible example for you but if you could give me some tips as to how to start to step in the R code of the lme4 package in debug mode that would be great !
UPDATE: showing the info I have on the error
The traceback is the following:
eval(expr, envir, enclos)
eval(substitute(browser(skipCalls = pos), list(pos = (length(sys.frames()) -
chol.default(Hessian)
chol(Hessian)
I am running gamboost using Caret. The model was generated, but the running process gives the following error message as shown below. I am not clear what does that mean.
rd<- train(formula0, data = df.clean,method = "gamBoost",trControl = train_control,metric="RMSE")
The model looks like this
The error messages are