Mark Kimpel wrote:
I am analyzing an experiment in which time is a factor, represented by
numbers indicating time since last treatment, but in this particular case
there is no reason to think that time has a numeric meaning in the sense
that 24 would be greater than 6. We have no idea which genes will be
increasing or decreasing at different times.

So I have the following model (to be applied over many genes):

mod <- lm(gene.expression ~ Treatment + Time)

If I wanted to just hack my way around this I could just paste a character
to all of the times, but I'm curious as to the right way to do this.

What would be the correct syntax or transformation? Would Time <-
factor(as.character(Time)) do it? I want to make sure that it does not get
coerced back to numeric.

Just factor(Time) should do it. (If you do as.character first, you get the levels sorted alphabetically, which you'd probably rather not).

--
   O__  ---- Peter Dalgaard             Ă˜ster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalga...@biostat.ku.dk)              FAX: (+45) 35327907

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to