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

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)