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
Error in Grid.Call(L_Textbounds, As.Graphicsannot(X$Label), X$X, X$Y,:Polygon Edge Not Found
Split a Column of Concatenated Comma-Delimited Data and Recode Output as Factors
Why Apply() Returns a Transposed Xts Matrix
Adding Text to a Grid.Table Plot
Ggplot2: Curly Braces on an Axis
A Matrix Version of Cor.Test()
Remove Columns from Dataframe Where Some of Values Are Na
How to Efficiently Use Rprof in R
R Error in X$Ed:$ Operator Is Invalid for Atomic Vectors
Short Formula Call for Many Variables When Building a Model
List Distinct Values in a Vector in R
Rotate a Matrix in R by 90 Degrees Clockwise
Converting a Data Frame to Xts
Find the Intersection of Overlapping Ranges in Two Tables Using Data.Table Function Foverlaps