Creates a vector of integer identifiers corresponding to the rows of a CompadreDB object, based on unique combinations of the column 'SpeciesAccepted' and a list of matrix stage class definitions (either 'MatrixClassAuthor' or 'MatrixClassOrganized').

cdb_id_stages(cdb, stage_def = "MatrixClassAuthor")

Arguments

cdb

A CompadreDB object

stage_def

Whether to define matrix stage class based on "MatrixClassAuthor" or "MatrixClassOrganized" (see Details). Defaults to "MatrixClassAuthor".

Value

Vector of integer identifiers corresponding to the rows of

cdb.

Details

The vector 'MatrixClassOrganized' reflects standardized stage classes ('prop', 'active', or 'dorm'), whereas 'MatrixClassAuthor' reflects a description of the stage classes as defined by the original author (e.g. c('Seedling', 'Medium rosette', 'Large (2 rosettes)', 'Flowering')).

Because the 'MatrixClassAuthor' definitions are less standardized, they are more prone to typos that could lead to slight differences between stage descriptions of matrices that really do have the same stage classes (e.g. a set of matrices from a single study/species/population). Therefore, using 'MatrixClassAuthor' to define stage classes is potentially prone to mistakenly 'splitting' identifiers that should really be the same.

'MatrixClassOrganized' has the opposite problem. It's possible for two matrices from a given study to have the same stage definitions based on 'MatrixClassOrganized', but legitimately differ in stage definitions as defined by the author. Therefore, using 'MatrixClassAuthor' to define stage classes is potentially prone to mistakenly 'lumping' identifiers that should actually differ.

Because the majority of studies in COM(P)ADRE use a single set of stage definitions for all matrices, and typos are rare, results for the different stage definitions will usually be similar. Note, however, that the actual integers returned for the different stage definitions are likely to be very different (because they are based on alphabetical order).

Author

Patrick Barks <patrick.barks@gmail.com>

Examples

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