Try this workaround
sapply(x, function(x) is.numeric(x))
dt
FALSE
is.numeric is primitive, and primitive functions don't always play well
with [sl]apply.
On Tue, 29 Jul 2008, McGehee, Robert wrote:
FYI,
I've tried posting the below message twice to the bug tracking system,
once by email (below), and the second time 5 days later directly to the
bugs.r-project.org website. As far as I can tell, the bug tracking
system hasn't picked this up. Also it looks like the latest "incoming"
bug is dated 25 May 2008, so perhaps others are having difficulty as
well. (cc: r-bugs)
Cheers, Robert
-----Original Message-----
From: McGehee, Robert
Sent: Monday, July 14, 2008 9:51 AM
To: [EMAIL PROTECTED]
Subject: sapply(Date, is.numeric)
R-developers,
The results below are 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"
platform i386-pc-mingw32
arch i386
os mingw32
system i386, mingw32
status
major 2
minor 7.0
year 2008
month 04
day 22
svn rev 45424
language R
version.string R version 2.7.0 (2008-04-22)
Thanks,
Robert McGehee, CFA
Geode Capital Management, LLC
One Post Office Square, 28th Floor | Boston, MA | 02109
Tel: 617/392-8396 Fax:617/476-6389
mailto:[EMAIL PROTECTED]
This e-mail, and any attachments hereto, are intended fo...{{dropped:12}}
______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
--
Brian D. Ripley, [EMAIL PROTECTED]
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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel