R/util.R

Defines functions broadcast

#
# Ensure a numeric vector has a certain length.
# Repeat input if input length is 1.
# Strip any names if present.
#
broadcast <- function(vec, n) {
    assert_that(is.numeric(vec))
    names(vec) <- NULL
    if (length(vec) == 1)
        vec <- rep(vec, n)
    assert_that(length(vec) == n)
    vec
}

Try the topconfects package in your browser

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

topconfects documentation built on Nov. 8, 2020, 6:25 p.m.