Skip to content

Commit

Permalink
Coerce binned object into integer bins
Browse files Browse the repository at this point in the history
  • Loading branch information
hadley committed Mar 19, 2013
1 parent ff20675 commit 073e455
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions R/bin.r
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ setMethod("show", "Rcpp_BinnedVector", function(object) {
"Width: ", object$width(), " Origin: ", object$origin(), "\n", sep = "")
})

setMethod("as.integer", "Rcpp_BinnedVector", function(x, ...) {
vapply(seq_len(x$size()), x$bin_i, integer(1))
})


is.binned <- function(x) {
is(x, "Rcpp_BinnedVector")
}
Expand Down

0 comments on commit 073e455

Please sign in to comment.