Skip to content

lapply can't handle the IDate class (but apply can) #1315

@gwerbin

Description

@gwerbin

The issue seems to be somewhere in converting from a plain vector to a list.

Compare:

sapply(as.IDate("2015-05-03"), identity)
# Error in as.Date.default(x, ...) : 
  do not know how to convert 'x' to class “Date”

traceback()
#10: stop(gettextf("do not know how to convert '%s' to class %s", 
#                   deparse(substitute(x)), dQuote("Date")), domain = NA)
#9: as.Date.default(x, ...)
#8: as.Date(x, ...)
#7: as.IDate(as.Date(x, ...))
#6: as.IDate.default(NextMethod())
#5: as.IDate(NextMethod())
#4: as.list.IDate(X)
#3: as.list(X)
#2: lapply(X = X, FUN = FUN, ...)
#1: sapply(as.IDate("2015-05-03"), identity)

with

apply(cbind(as.IDate("2015-05-03")), 1, identity)
# [1] 16558

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions