AdjustDataToReflectWeights: 'AdjustDataToReflectWeights'

View source: R/dataframe.R

AdjustDataToReflectWeightsR Documentation

AdjustDataToReflectWeights

Description

Creates a new data.frame to reflect weights.

Usage

AdjustDataToReflectWeights(data, weights, seed = 123, silent = FALSE)

Arguments

data

A data.frame.

weights

The sampling or replication weights.

seed

The seed used in random number generation. If NULL, the seed is not set.

silent

If FALSE, a warning is given if the weights are non-integers.

Details

In situations where an algorithm does not accomodate weights, this function modifies the data.frame by either: (A) stretching it out, where the the weights are integers, or (B) resampling to create a new bootstrapped data.frame, where the weights are proportional to the probability of selection. When creating the bootstrap sample, the sample size is whichever is greatest of the rounded sum and 1. # Inspired by Zelig, 13-11-15.


Displayr/flipTransformations documentation built on Feb. 26, 2024, 12:47 a.m.