[R] unwanted conversion of date formats in 2.3.1 to character
Prof Brian Ripley
ripley at stats.ox.ac.uk
Mon Aug 7 17:45:49 CEST 2006
Row names of data frames are supposed to be character: if this worked in
2.2.1 it was a bug there.
attributes(result)$row.names<- is not the way to assign an attribute
(attr("row.names") <- is) and definitely not the way to assign row names
(row.names(xx) <- is), and this may explain how you managed to circumvent
the checks until now.
On Mon, 7 Aug 2006, lorenzo.logi at hsbc.fr wrote:
>
> good morning
> I'm using R 2.2.1 on windows (2000/NT/XP) and trying to upgrade to 2.3.1
>
> I am finding the curious problem of date/time data (both if stocked as date and as POSIX) that gets converted into character format whenever touched: it seems that date/time data just does not want to remain that way.
>
> For example, a data.frame containing dates or POSIXct as row.names that is returned as result from a function arrives to the calling function with characters as row.names:
> pippo<-function(...) {
> result<-data.frame( ... )
> attributes(result)$row.names<- ... (some dates or POSIX)
> #mode(attributes(xx)$row.names) is now numeric, = date or POSIX
> return(result)
> }
>
> xx <- pippo(...)
> #mode(attributes(xx)$row.names) is now character !!!!
>
> This is new to 2.3.1 (and to 2.3.0 i suppose), i.e. everything worked
> like a charm in 2.2.1; it looks like a bug to me (but might notbe), and
> I have not been able to find any reference to such a problem in the
> archives (which is strange, but I might have got blind).
>
> Any idea pls?
> Thanks a lot in advance
--
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
More information about the R-help
mailing list