Skip to content

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

Closed

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

Activity

  1. changed the title [-]`sapply` can't handle the `IDate` class[/-] [+]`lapply` can't handle the `IDate` class (but `apply` can)[/+] on Sep 9, 2015
  2. added this to the v1.9.6 milestone on Sep 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions