On Tue, 23 Dec 2008, Tom La Bone wrote:



Gavin Simpson wrote:


It says that the two arguments have different numbers of observations.
The reason for which should now be pretty obvious as you provided a
single Date whereas airquality has 153 observations.



Thanks. I did look at ?transform but I was a bit confused because this
worked

  data1 <- transform(airquality,LTMDA=T)

What is "T"? (If you mean 'TRUE', please say so, as "T" is a regular variable.)

whereas this did not

 data1 <- transform(airquality,Date=as.Date("1950-01-01"))

Why does the first one work with one argument but the second one does not?

A Date object is not a vector. In released versions of R, data.frame() only knows how to replicate vectors and factors.

As Gavin pointed out, you were warned so why are you disregarding the warning? That a subclass works does not mean that you are entitled to leap to conclusions about another subclass, does it? Abductive inference does not apply (it would be like useRs considering you to be always in error based on your email address).

--
Brian D. Ripley,                  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
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