~hrbrmstr/tdigest

b6e8046e52878c22f34d8c8f72e0bae61fbca865 — boB Rudis 5 years ago a1fd3cc
print method update
1 files changed, 6 insertions(+), 2 deletions(-)

M R/create.R
M R/create.R => R/create.R +6 -2
@@ 78,6 78,10 @@ print.tdigest <- function(x, ...) {
    cat(
      "<tdigest; size=",
      formatC(td_total_count(x), format="fg", big.mark=","),
      "; compression=",
      formatC(.Call("Rg_compression", x, PACKAGE="tdigest"), format="fg", big.mark=","),
      "; cap=",
      formatC(.Call("Rg_cap", x, PACKAGE="tdigest"), format="fg", big.mark=","),
      ">\n", sep=""
    )
  }


@@ 226,7 230,7 @@ length.tdigest <- function(x) {
#' as_tdigest(as.list(td))
as.list.tdigest <- function(x, ...) {
  stopifnot(inherits(x, "tdigest"))
  out <- .Call("Rg_toR", x)
  out <- .Call("Rg_toR", x, PACKAGE="tdigest")
  class(out) <- c("tdigest_list", "list")
  out
}


@@ 235,5 239,5 @@ as.list.tdigest <- function(x, ...) {
#' @export
as_tdigest <- function(x) {
  stopifnot(inherits(x, "tdigest_list"))
  .Call("Rg_fromR", x)
  .Call("Rg_fromR", x, PACKAGE="tdigest")
}