R/formatg.R

Defines functions formatg

Documented in formatg

#' Intermediate function for \code{causalTree}
#'
#' @param x input training data
#' @param digits number of digits to be kept
#' @param format format of exported vector
#' @returns No return value, called for formatting the exported estimates
#'
## format a set of numbers using C's "g" format
## No longer exported.
formatg <- function(x, digits = getOption("digits"),
                    format = paste0("%.", digits, "g"))
{
    if (!is.numeric(x)) stop("'x' must be a numeric vector")

    temp <- sprintf(format, x)
    if (is.matrix(x)) matrix(temp, nrow = nrow(x)) else temp
}

Try the htetree package in your browser

Any scripts or data that you put into this service are public.

htetree documentation built on April 4, 2025, 5:15 a.m.