Learn R Programming

diffdfs (version 0.9.0)

checkkey: Check That A Dataframe Key Col Set Is Unique

Description

Checks that a provided vector of column names constitue a unique key (that is, no rows are duplicated) for a dataframe.

Usage

checkkey(df, key_cols, verbose = FALSE)

Value

TRUE if key cols have unique rows; FALSE if not

Arguments

df

a dataframe

key_cols

vector of column names

verbose

TRUE/FALSE should we print a message?

Examples

Run this code
irisint = iris
irisint$rownum = 1:nrow(irisint)
key_cols = c("rownum")
checkkey(irisint, key_cols, TRUE)
checkkey(irisint, "Species", TRUE)

Run the code above in your browser using DataLab