Quantcast

sapply(Date, is.numeric) (PR#12008)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

sapply(Date, is.numeric) (PR#12008)

McGehee, Robert
Full_Name: Robert McGehee
Version: 2.7.1
OS: Windows
Submission from: (NULL) (192.223.226.6)


R-developers,
The results below seem inconsistent. From the documentation for is.numeric, I
expect FALSE in both cases.

> x <- data.frame(dt=Sys.Date())
> is.numeric(x$dt)
[1] FALSE
> sapply(x, is.numeric)
  dt
TRUE

## Yet, sapply seems aware of the Date class
> sapply(x, class)
  dt
"Date"

Thanks,
Robert

PS. Sorry if this sent twice. I originally sent this on Monday to
[hidden email], but it didn't seem to go through. Perhaps it's a
deprecated  email address (?).

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: sapply(Date, is.numeric) (PR#12008)

Prof Brian Ripley
For the record: this is now fixed.

On Thu, 7 Aug 2008, [hidden email] wrote:

> Full_Name: Robert McGehee
> Version: 2.7.1
> OS: Windows
> Submission from: (NULL) (192.223.226.6)
>
>
> R-developers,
> The results below seem inconsistent. From the documentation for is.numeric, I
> expect FALSE in both cases.
>
>> x <- data.frame(dt=Sys.Date())
>> is.numeric(x$dt)
> [1] FALSE
>> sapply(x, is.numeric)
>  dt
> TRUE
>
> ## Yet, sapply seems aware of the Date class
>> sapply(x, class)
>  dt
> "Date"
>
> Thanks,
> Robert
>
> PS. Sorry if this sent twice. I originally sent this on Monday to
> [hidden email], but it didn't seem to go through. Perhaps it's a
> deprecated  email address (?).
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

--
Brian D. Ripley,                  [hidden email]
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

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Loading...