Re: [Rd] A couple of issues with colClasses/setAs

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Thu 09 Sep 2004 - 02:49:52 EST


On 8 Sep 2004, Peter Dalgaard wrote:

> 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.

I've done some. If you allow columns to be dropped it gets increasing hard to work out what as.is for example refers to, so I am looking at allowing named vectors.

> 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.

Is it really so hard to convert such columns from character afterwards?

-- 
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-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Thu Sep 09 02:53:22 2004

This archive was generated by hypermail 2.1.8 : Fri 18 Mar 2005 - 09:00:13 EST