Joe Kaser wrote:
Thanks for the help. ifelse does the job.
Could you elaborate, or give an example of the "awkward" things ifelse
might do to classed objects?
It strips the class. One thing that usually gets me is this:
> dd <- as.Date(c("2008-1-2","2007-3-21"))
> ifelse(dd>as.Date("2008-1-1"),dd+7,dd)
[1] 13887 13593
> dd
[1] "2008-01-02" "2007-03-21"
> dd+7
[1] "2008-01-09" "2007-03-28"
(Actually, the result gets the attributes of the _condition_, which is
usually no help at all.)
--
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
~~~~~~~~~~ - ([EMAIL PROTECTED]) 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.