[R] Re: coding factor replicates
Uwe Ligges
ligges at statistik.uni-dortmund.de
Wed Jan 23 23:11:14 CET 2002
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
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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