Learn R Programming

ffbase (version 0.6-2)

key: Creates a unique integer key for unique combinations of rows of an ffdf

Description

Creates a unique integer key for unique combinations of rows of an ffdf. In database terms this would correspond to a primary or foreign key. Orders the ffdf decreasingly alongside the columns with NA's as last in the order and creates the integer key.

Usage

key(x, ...)

Arguments

x
an ffdf
...
other parameters passed on to chunk

Value

  • An integer ff vector of the same length as the number of rows in x with unique values for each unique row

Examples

Run this code
oldffmaxbytes <- getOption("ffmaxbytes")
options(ffmaxbytes = 20)
ffiris <- as.ffdf(iris)
ffiris$key1 <- key(ffiris)
ffiris$key2 <- key(ffiris[c("Petal.Width","Species")])
unique(ffiris[c("key2","Petal.Width","Species")])[,]
options(ffmaxbytes = oldffmaxbytes)

Run the code above in your browser using DataLab