[R] vector problems
mark at myatt.demon.co.uk
Tue Nov 6 12:09:18 CET 2001
Christopher Fonnesbeck <chris at fonnesbeck.net> writes:
>I dont get it:
>Error in unique(c(mydf)) : unique() applies only to vectors
>Is it a vector or not? This stuff is driving me nuts. I'm simply trying
>to convince R that my grouping vector is actually a vector so that
>unique will work. Its just a vector of numbers, so why shouldnt it work?
See the "Operators" section of the language definition in the help
system ... data.frames are implemented as lists and the way to access
list components is to use the $ operator with the component name (e.g.
(mydf$var) or using the [[ operator with the index of the component
(e.g. mydf[]). You need something like:
I hope that helps.
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
More information about the R-help