[R] Cutting vectors
Patrik Waldmann
Patrik.Waldmann at sysbot.lu.se
Sun Apr 2 17:49:48 CEST 2000
> Patrik Waldmann wrote:
>
> > I have one factor with say five levels (fact) of different size and a corresponding variable (var). I randomly generate five new levels (nfact ex. 2,2,1,5,4). What I would like to do is to extract the corresponding variable values into a new variable (nvar). I did try the following, why doesn't it work? nvar<-var[fact==nfact[ ]]
>
> ..I ain't sure I get evrything but try
>
>
> nvar<-var[which(fact == nfact)]
>
Gives me the same error message as before (and creates a meaningless vector):
Warning messages:
1: longer object length
is not a multiple of shorter object length in: is.na(e1) | is.na(e2)
2: longer object length
is not a multiple of shorter object length in: ==.default(fact, nfact)
Has this something to with the non-equal size of the 'cuttings'?
Patrik
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
mailing list