Skip to content
Prev 305556 / 398506 Next

$ operator is invalid for atomic vectors

On 14.09.2012 22:16, Steve Lianoglou wrote:
Hello,

I had a similar problem and I found two solutions

1) Don't use the $ op on atomic vectors;-). Instead try:
       dataf2sp<-dataf2[dataf2["abbrev"]==abbrev,]

2) Make the vector a list. I don't know if there are side-Effects to
this, but perhaps it's just the anxiety of a Java-Programmer who isn't
used to the somewhat easy-going way R deals with classes:
       class(dataf2) <- "list"

Regards,
Moritz