Gabor Grothendieck
2005-Apr-18 15:28 UTC
[R] colClasses = "Date" in read.delim, how to pass date-format?
On 4/18/05, Christoph Lehmann <christoph.lehmann at gmx.ch> wrote:> Hi > 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")) ? >Check out: http://tolstoy.newcastle.edu.au/R/help/05/02/12003.html
Christoph Lehmann
2005-Apr-18 15:42 UTC
[R] colClasses = "Date" in read.delim, how to pass date-format?
Hi 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")) ? thanks for a hint cheers christoph
Prof Brian Ripley
2005-Apr-18 16:53 UTC
[R] colClasses = "Date" in read.delim, how to pass date-format?
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 at 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
Maybe Matching Threads
- large dataset import, aggregation and reshape
- combining data from multiple read.delim() invocations.
- Read in date fomat while colClasses="character"
- read.table(..., header == FALSE, colClasses = <vector with names attribute>)
- Any way to get read.table.ffdf() (in the ff package) to pass colClasses or comment.char parameters through to read.fwf() ?