Skip to contents

An observational unit is the entity that is being measured in a study. For example, if blood pressure of a person is measured, then the person is the observational unit. If blood pressure is measured multiple times for a person, then the observational unit is the person and the time of measurement.

Usage

is_observational_unit(.data, ..., .check_redundancy = TRUE)

is_obs_unit(.data, ..., .check_redundancy = TRUE)

Arguments

.data

The data frame

...

The columns in the data frame that potentially index the observational unit.

.check_redundancy

Logical. If TRUE, checks if any of the columns are redundant.

Value

A single logical value. TRUE if the selected columns uniquely identify each row of .data (and, when .check_redundancy = TRUE, no selected column is redundant), and FALSE otherwise. In an interactive session, a message with the result is also printed.

Details

Supply the columns that potentially index the observational unit. The column cannot uniquely identify the row. If the number of rows in the data frame is equal to the number of distinct rows in the selected columns, then it returns TRUE, otherwise FALSE. If TRUE, it checks if any of the columns are redundant.

Examples

is_observational_unit(ChickWeight, Time, Chick)
is_observational_unit(ChickWeight, Time, Chick, Diet)
#> ✖ `Diet` is redundant.