Learn R Programming

dataset (version 0.3.1)

id_to_column: Add identifier to columns

Description

Add a prefixed identifier to the first column of the dataset.

Usage

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

Value

A dataset conforming the original sub-class of x.

Arguments

x

An R object that contains the data of the dataset (a data.frame or inherited from data.frame), for example, tibble::tibble(), tsibble::tsibble(), data.table::data.table().

prefix

Defaults to eg: (example.com).

ids

Defaults to NULL.

Examples

Run this code

# Example with a dataaset object:
id_to_column(iris_dataset)

# Example with a data.frame object:

id_to_column(iris, prefix="eg:iris-o")

Run the code above in your browser using DataLab