Re: [R] colClasses = "Date" in read.delim, how to pass date-format?

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Tue 19 Apr 2005 - 04:23:06 EST

On Mon, 18 Apr 2005, Christoph Lehmann wrote:

> so what do you recommend: I just need to be able to sort a data.frame
> according to the date entry, and e.g. compute differences between subsequent
> dates. Shall I stay with dates (thanks for the hint about confusion of Date
> and dates) or is there a better way for this kind of task?

I suggest you use "Date": read as character and convert using as.Date after reading.

>
> thanks a lot
> Cheers
> Christoph
>> You are confusing class "Date" (part of R) with class "dates" (part of
>> package chron). There is no as() method for class "dates", so you can't
>> do this. You can read the column as character (not factor) and convert
>> later, but it sounds like the `huge amount of memory (and time)' is in
>> fact taken by package chron.
>>
>> On Mon, 18 Apr 2005, Christoph Lehmann wrote:
>>
>>> I have a huge data-set with one column being of type date.
>>> Of course I can import the data using this column as "factor" and then
>>> convert it later to dates, using:
>>>
>>> sws.bezuege$FaktDat <- dates(as.character(sws.bezuege$FaktDat),
>>> format = c(dates = "d.m.y"))
>>>
>>>
>>> But the conversion requires a huge amount of memory (and time),
>> therefore I
>>> would like to use colClasses = c("Date"). My question is:
>>> since I have format = c(dates = "d.m.y"), how can I pass this option to
>>> read.delim(..., colClasses = c("Date")) ?
>>
>> --
>> Brian D. Ripley, ripley@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
>>
>
> --
> +++ GMX - Die erste Adresse für Mail, Message, More +++
>
> 1 GB Mailbox bereits in GMX FreeMail http://www.gmx.net/de/go/mail
>
>

-- 
Brian D. Ripley,                  ripley@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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Received on Tue Apr 19 04:27:31 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:15 EST