Re: [R] unwanted conversion of date formats in 2.3.1 to character

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Tue 08 Aug 2006 - 01:45:49 EST

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@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@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
and provide commented, minimal, self-contained, reproducible code.
Received on Tue Aug 08 01:53:11 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 08 Aug 2006 - 02:21:44 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.