pk {crunch}R Documentation

Get and set the primary key for a Crunch dataset

Description

A primary key is a variable in a dataset that has a unique value for every row. A variable must be either numeric or text type and have no duplicate or missing values. A primary key on a dataset causes appends to that dataset that have the rows with the same primary key value(s) as the first dataset to update the existing rows rather than inserting new ones.

Usage

pk(x)

pk(x) <- value

Arguments

x

a Dataset

value

For the setter, a single Variable to use as the primary key or NULL to remove the primary key.

Value

Getter returns the Variable object that is used as the primary key (NULL if there is no primary key); setter returns x duly modified.


[Package crunch version 1.30.1 Index]