Skip to contents

This function loops through the given data.frame and returns the name of the first column it finds that could be used as a primary key. That is, the first column where the length of unique values equals the number of rows.

Usage

find_primary_key_column(df)

Arguments

df

a data.frame to search for a primary key.

Value

the name of the first column that could be a primary key or NULL if one could not be found.