Prof Brian Ripley wrote:
A Date object is not a vector. In released versions of R, data.frame()
only knows how to replicate vectors and factors.
That's a rather oblique way of saying that it actually does work with
the unreleased version:
> head(transform(airquality,Date=as.Date("1950-01
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 b
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 t
> I would like to add a column to the airquality dataset that contains the date
> 1950-01-01 in each row. This method does not appear to work:
>
> > attach(airquality)
> > data1 <- transform(airquality,Date=as.Date("1950-01-01"))
>
> Error in data.frame(list(Ozone = c(41L, 36L, 12L, 18L, NA, 28L,
or not using transform at all:
data1 <- airquality
data1$Date <- as.Date("1950-01-01")
# or in just one line:
data1 <- replace(airquality, "Date", as.Date("1950-01-01"))
On Tue, Dec 23, 2008 at 9:06 AM, Gavin Simpson wrote:
> On Tue, 2008-12-23 at 05:24 -0800, Tom La Bone wrote:
>> I would li
On Tue, 2008-12-23 at 05:24 -0800, Tom La Bone wrote:
> I would like to add a column to the airquality dataset that contains the date
> 1950-01-01 in each row. This method does not appear to work:
>
> > attach(airquality)
> > data1 <- transform(airquality,Date=as.Date("1950-01-01"))
>
> Error in
6 matches
Mail list logo