Post
R Programming
how to resolve the error $ operator is invalid for atomic vectors?
here is my code
y<-c(1,2)
y
names(y)<- c("marvel","adam")
y$ed
But, why am i getting the error called $ operator is invalid for atomic vectors
Posted on 30th May 2023
If you are willing to use $ you just need to convert it to a data.frame just follow the below example
y <- c(1, 2)
y
names(y) <- c("marvel", "adam")
y <- as.data.frame(t(x))
y$ed
[1] 2
STILL GOT QUERIES?
Copyright © 2013 - 2023 MindMajix Technologies