View source: R/create_dataset_summary_table.R
is_unique_column | R Documentation |
Check if a column in a dataframe has unique values
is_unique_column(column_name, data_frame)
column_name |
The name of the column to check for uniqueness. |
data_frame |
A dataframe containing the column to check. |
TRUE
if the column has unique values, FALSE
otherwise.
# Create a dataframe with a unique ID column
data_frame <- tibble::tibble(
id = c(1, 2, 3, 4, 5),
value = c("a", "b", "c", "d", "e")
)
is_unique_column("id", data_frame) # Returns TRUE
# Create a dataframe with duplicate values in the ID column
data_frame <- tibble::tibble(
id = c(1, 2, 3, 4, 5, 1),
value = c("a", "b", "c", "d", "e", "a")
)
is_unique_column("id", data_frame) # Returns FALSE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.