From p.dalgaard at biostat.ku.dk  Wed Sep  8 16:38:58 2004
From: p.dalgaard at biostat.ku.dk (Peter Dalgaard)
Date: Wed Sep  8 16:39:29 2004
Subject: [Rd] A couple of issues with colClasses/setAs
In-Reply-To: <x28ybl843g.fsf@biostat.ku.dk>
References: <Pine.LNX.4.44.0409081019001.8331-100000@gannet.stats>
	<x28ybl843g.fsf@biostat.ku.dk>
Message-ID: <x2y8jk7rlp.fsf@biostat.ku.dk>

Peter Dalgaard <p.dalgaard@biostat.ku.dk> writes:

> To make it actually work, we should probably fixup the "what" that is
> being passed to scan a bit further upstreams.
> 
> 
> > Might be a good idea to teach colClasses about "factor".
> 
> That's what I thought. Other ideas would be to predefine some standard
> date classes (it's a bit annoying that there's no way to give
> auxiliary information like formats), and maybe to allow a second
> header line containing class names.

Done already, I see (except the class-header idea, which probably
requires more thought). Thanks.

While we're in there should we perhaps consider adding pseudo-classes

"Ymd"
"dmY"
"mdY"
"Y/m/d"
"d/m-Y"
"m/d/Y"

etc?  Or perhaps it is better with a catchall "Date-fmt", i.e., e.g.,
"Date-%Y%m%d"? That'd be fairly easy to code:

else if (length(grep("^Date-",colClasses[i])))  
        as.Date(data[[i]], sub("^Date-(.*)$","\\1", colClasses[i]))

although perhaps not so easy to document concisely.
-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907


[Rd] A couple of issues with colClasses/setAs
Peter Dalgaard