clean_income: Utility functions

View source: R/utilities.R

clean_incomeR Documentation

Utility functions

Description

This utility us used to tidy up or provide warnings in the functions that use weights

Usage

clean_income(
  x,
  w = rep(1, length(x)),
  no.negatives = FALSE,
  no.nans = TRUE,
  no.infinites = TRUE,
  na.rm = TRUE
)

Arguments

x

an income vector or matrix

w

the vector of weights

no.negatives

a logical indicating whether negative values in the data should be removed. The default value is false

no.nans

a logical indicating whether NaN:s in the data should be removed. The default value is TRUE

no.infinites

a logical indicating whether infinite values in the data should be removedd. The default value is TRUE

na.rm

A logical indicating whether NA:s should be removed from the data. The default value is TRUE

Value

A matrix with as many columns equal to the number of columns in x plus one for the weights, and rows with the inappropriate oobservations removed.

Author(s)

Markus Jantti markus.jantti@iki.fi

See Also

complete.cases, na.omit

Examples


x <- c(NA, 1:5, Inf, -1, NaN, -Inf)
w <- rpois(length(x), 2)
clean_income(x, w)
x <- cbind(x, y = rpois(length(x), 10))
clean_income(x, w)


mjantti/incdist documentation built on Aug. 23, 2023, 5:33 p.m.