Create integer identifiers for a COM(P)ADRE database corresponding to unique combinations of a given set of columns
Source:R/cdb_id.R
cdb_id.Rd
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.
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.
See also
Other data management:
cdb_flatten()
,
cdb_id_stages()
,
cdb_id_studies()
,
cdb_mean_matF()
,
cdb_rbind()
,
cdb_unflatten()
,
cdb_unnest()
,
mpm_elementwise_apply()
,
mpm_mean()
,
mpm_median()
,
mpm_sd()
,
string_representation
Examples
cdb_id(Compadre, columns = c("SpeciesAuthor", "MatrixTreatment"))
#> [1] 108 71 3 53 48 100 111 57 20 98 93 17 69 113 19 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 45 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 18 14 86 8 13 81 73 44 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 47 29 27 41 104 51 100 87 15 59 70
#> [145] 30 10 54 15 24 46