R Error in X$Ed:$ Operator Is Invalid for Atomic Vectors

R error, $ operator is invalid for atomic vectors

In your instruction you pass x as atomic vector. That is why $ does not work. Use it like this: cachemean(makeVector(1:6)) and you get a result.

It won't be cached, though, because this code creates a temporary variable that will get lost. You need a place to store it to. Look at this:

test <- makeVector(c(2,4,6,8))
test$getmean()
# returns NULL because R discards the object when the function has finished
cachemean(test)
test$getmean()
# returns 5

Encounter Error: $ operator is invalid for atomic vectors when using ggsave

from ?ggsave the first argument is the file name whereas the second argument is the plot. Try -

ggsave("D:/ResearchesAndProjects/2021_2_ODEadditive/code-ode-additive/examples/plots/test.png",
fig, device = "png", type ="cairo")

R caret extractPrediction with random forest model: Error: $ operator is invalid for atomic vectors

I found a solution by looking at the documentation of extractPrediction. Basically, the argument models doesn't want a single model instance, but a list of models. So I just inserted list(my_rf = model) and not just model.

caret::extractPrediction(models = list(my_rf = model), testX = vali[,-c(3,5,1)], testY = vali[,1])

rfe() function Error: $ operator is invalid for atomic vectors

Rerun your code after replacing functions = 'rfFuncs' by functions = rfFuncs i.e. remove '' from the function name.



Related Topics



Leave a reply



Submit