[R] Re: coding factor replicates

Brad Buchsbaum brad at aris.ss.uci.edu
Wed Jan 23 23:20:49 CET 2002


On Wednesday 23 January 2002 02:11 pm, Uwe Ligges wrote:
> Brad Buchsbaum wrote:
> > Hi All,
> >
> > If I have a factor f:
> >
> > A B C B C A C B A A B ....
> >
> > and I would like to generate a factor to indicate the trial number
> > as a function of condition: e.g.
> >
> > 1 1 1 2 2 2 3 3 3 4 4 ...
> >
> > how might I attack this in R?
>
> What about something like
>   as.factor(outer(rep(1, 3), 1:4))
>
> Uwe

I should have mentioned that the condtions A, B, C vary randomly,
so I have to perform some operation on the existing factor "f".

Brad B.

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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