identifier: Object identifier.

Description Usage Arguments Value Examples

Description

'compute_id' calculates an unique identifier based on the contents of the object 'x'.

the default implementation of 'compute_id' uses the __sha1__ algorithm implemented in [digest::digest].

'as_id' turns a 40-character string into an identifier.

'is_id' tests whether 'x' is an identifier.

'long' forces printing of all 40 characters of an identifier.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
compute_id(x)

## Default S3 method:
compute_id(x)

as_id(x)

is_id(x)

## S3 method for class 'identifier'
print(x, ...)

## S3 method for class 'identifier'
toString(x, ...)

long(x)

match_short(short, store)

Arguments

x

object to compute identifier for ('compute_id'), the identifier to print or cast to 'character' ('print' and 'toString'), a 'character' value to cast as an identifier ('as_id') or a value to be tested ('is_id').

...

Arguments passed on to base::print

x

an object used to select a method.

short

8-character string to match.

store

object store where 'short' is expected to be matched.

Value

Object of class '"identifier"'.

Examples

1
2
3
4
5
6
7
i <- compute_id(iris)

toString(i) # returns 8-character string
toString(long(i)) # returns 40-character string

print(i) # prints 8 characters
print(long(i)) # prints 40 characters

lbartnik/storage documentation built on May 20, 2019, 8:27 p.m.