balance_observations {disprofas}R Documentation

Balance observations

Description

The function balance_observations() balances the number of observations of two groups.

Usage

balance_observations(data, groups, n_obs)

Arguments

data

A data frame with the dissolution profile data in wide format.

groups

A logical vector specifying different groups.

n_obs

An integer specifying the minimal number of observations each group should have.

Details

First, the largest common value between n_obs and the number of observations of the two groups specified by groups is sought. Then, the number of observations of the two groups are extended according to the value found. Extension means that the maximal possible number of observations is duplicated in order to obtain the required number of observations. Thus, in the data frame that is returned the two groups will have the same number of observations. Either the number of observations of both groups is extended (to match the number of n_obs), or, if n_obs and the number of observations of one of the two groups is equal, only the number of observations of one of the two groups.

Value

The original data frame extended by the observations necessary to have a balanced number of observations between the two groups.


[Package disprofas version 0.1.3 Index]