Skip to contents

Unique values are extracted from the named column in a data frame. In the case of a harp_list, unique values across all of the data frames in the list are extracted as a single vector. If a column is not found, a warning is issued and NULL is returned.

Usage

unique_col(.data, col)

unique_stations(.data)

unique_valid_dttm(.data)

unique_fcst_dttm(.data)

Arguments

.data

A data frame or harp_list

col

The column from which to extract the unique values. Can be quoted or unquoted.

Value

A vector of unique values.

Details

unique_stations, unique_fcst_dttm and unique_valid_dttm are wrappers around unique_col that extract the unique stations, valid date-time and forecast start date-time using the standard harp column names "SID", "valid_dttm" and "fcst_dttm" respectively.

Examples

unique_col(det_point_df, fcst_dttm)
#> [1] "2021-01-01 UTC"
unique_col(det_point_df, SID)
#> [1] 1001 1002

# Works with quoted column names too
unique_col(det_point_df, "SID")
#> [1] 1001 1002

# Use {{<var>}} for variables as columns
my_col <- "SID"
unique_col(det_point_df, {{my_col}})
#> [1] 1001 1002