Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

pk

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.


crunch

Crunch.io Data Tools

v1.28.0
LGPL (>= 3)
Authors
Greg Freedman Ellis [aut, cre], Jonathan Keane [aut], Mike Malecki [aut], Neal Richardson [aut], Gordon Shotwell [aut]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.