id_to_column: Add Identifier to First Column of a Dataset

View source: R/id_to_column.R

id_to_columnR Documentation

Add Identifier to First Column of a Dataset

Description

Adds a prefixed identifier (e.g., ⁠eg:⁠) to the first column of a dataset, useful for generating semantic row IDs (e.g., for RDF serialization).

Usage

id_to_column(x, prefix = "eg:", ids = NULL)

Arguments

x

A dataset created with dataset_df(), or a regular data frame.

prefix

A character string used as the prefix for row identifiers. Defaults to "eg:" (referring to example.com).

ids

Optional. A character vector of custom IDs to use instead of row names.

Value

A dataset of the same class as x, with the first column updated to include unique prefixed identifiers.

Examples

# Example with a dataset_df object:
id_to_column(orange_df)

# Example with a regular data.frame:
id_to_column(Orange, prefix = "orange:")


dataset documentation built on Nov. 16, 2025, 5:06 p.m.