Creates a vector of integer identifiers corresponding to the rows of a CompadreDB object, based on unique combinations of the elements in a given set of columns.

cdb_id(cdb, columns)

Arguments

cdb

A CompadreDB object

columns

Vector of column names from which unique combinations should be identified

Value

Vector of integer identifiers corresponding to the rows of cdb, based on unique combinations of the elements in columns.

Details

Identifiers are assigned by pasting together the relevant columns, assigning factor levels based on alphabetical order, and then converting the factor levels to integers.

Examples

cdb_id(Compadre, columns = c("SpeciesAuthor", "MatrixTreatment"))
#> [1] 108 71 3 53 48 100 111 57 20 98 93 17 69 113 18 96 62 92 #> [19] 35 119 85 49 88 107 90 23 76 89 115 58 6 118 39 37 25 66 #> [37] 50 98 11 102 101 77 68 106 5 21 55 121 57 95 26 67 34 109 #> [55] 65 122 73 37 11 72 4 8 22 114 1 44 14 120 123 31 28 9 #> [73] 99 74 79 33 84 37 72 103 105 57 42 52 26 116 13 60 63 12 #> [91] 16 94 43 78 19 14 86 8 13 81 73 47 64 97 91 15 117 7 #> [109] 112 79 75 110 78 82 25 32 61 107 120 42 17 57 118 64 2 80 #> [127] 36 83 38 102 56 40 58 46 29 27 41 104 51 100 87 15 59 70 #> [145] 30 10 54 15 24 45