3 hours spending trying to understand what happened on my files
WRONG WAY : a subset on subset
DataA=subset(Data,Data$var1=="1")
DataA$newvar=Results$cluster
DataB=subset(DataA,Data$newvar=="7")
GOOD WAY : one subset per object
DataA_var1=subset(Data,Data$var1=="1")
DataA_var1$newvar=Results$cluster
DataB=subset(DataA_var1,Data$newvar=="7")
I read a lot on $ operator is invalid for atomic vectors
This error was also linked to "incorrect number of dimensions" in my case (I tried the trick as.data.frame()
)
I re installed last RStudio version.
My point is : if you have a $ operator is invalid for atomic vectors
error, this is not necessary a typeof()
issue...
Try to see if you used twice subset()
on the same object.