[R] <NA> from cut.Date

Benjamin Tyner btyner at gmail.com
Wed Sep 17 13:04:25 CEST 2014


Hello,

I'm wondering if this is expected?

    > cut(structure(11111, class="Date"), structure(c(11100,11111),
class="Date"))
    [1] <NA>
    Levels: 2000-05-23

The help page says that "for ‘"Date"’ objects, only ‘"day"’, ‘"week"’,
‘"month"’, ‘"quarter"’ and ‘"year"’ are allowed" [for the 'breaks'
argument]. Though I am not sure whether this statement is only
applicable in the context of the previous sentence about interval
specification (i.e., a roundabout way of saying that ‘"sec"’, ‘"min"’,
‘"hour"’, and ‘"DSTday"’ are not allowed for 'Date' objects), or whether
it also means that a vector of cut points (as in my example) is likewise
not allowed? If the latter, then perhaps the function out to error out
rather than return <NA> in this case?

Regards
Ben



More information about the R-help mailing list