check_weights: Check that weights vector is proper

View source: R/TS_on_LDA.R

check_weightsR Documentation

Check that weights vector is proper

Description

Check that the vector of document weights is numeric and positive and inform the user if the average weight isn't 1.

Usage

check_weights(weights)

Arguments

weights

Vector of the document weights to evaluate, or TRUE for triggering internal weighting by document sizes.

Value

An error message is thrown if weights is not proper, else NULL.

Examples

  check_weights(1)
  wts <- runif(100, 0.1, 100)
  check_weights(wts)
  wts2 <- wts / mean(wts)
  check_weights(wts2)
  check_weights(TRUE)


LDATS documentation built on Sept. 19, 2023, 5:08 p.m.