R Error in x$ed : $ operator is invalid for atomic vectors

前端 未结 6 1582
野的像风
野的像风 2020-11-29 17:45

Here is my code:

x<-c(1,2)
x
names(x)<- c(\"bob\",\"ed\")
x$ed

Why do I get the following error?

Error in x$ed

6条回答
  •  旧巷少年郎
    2020-11-29 18:06

    You get this error, despite everything being in line, because of a conflict caused by one of the packages that are currently loaded in your R environment.

    So, to solve this issue, detach all the packages that are not needed from the R environment. For example, when I had the same issue, I did the following:

    detach(package:neuralnet)
    

    bottom line: detach all the libraries no longer needed for execution... and the problem will be solved.

提交回复
热议问题