Since the changes in #51, value is a much more flexible version of what return_type was.
However, it is now really easy for users to do irrational things without a warning.
Since its currently implementation just looks up the data given and subsets it by the result of the function it is in. In some cases the result of the function is observation indexes (obs) and other times it is taxon indexes (subtaxa, roots, etc). It is now easy to subset taxa info with obs indexes and visa versa, which does not make sense:
I think either a warning should be issued or the function should do its best to convert between taxon indexes and obs indexes when possible and error when not.
For example, ex_taxmap$obs("info", value = "taxon_names") could look up the taxon_names associated with the observations indexes, assuming a taxon_id column exists in ex_taxmap$data$info.
Also, ex_taxmap$supertaxa(value = "n_legs") could look for rows in ex_taxmap$data$info assigned to taxa in the output of supertaxa and use the n_legs values there. This would return NA for taxa not in ex_taxmap$data$info and error if there is more than one entry per taxon, which would be common in many situations.
Since the changes in #51,
value
is a much more flexible version of whatreturn_type
was. However, it is now really easy for users to do irrational things without a warning. Since its currently implementation just looks up the data given and subsets it by the result of the function it is in. In some cases the result of the function is observation indexes (obs
) and other times it is taxon indexes (subtaxa
,roots
, etc). It is now easy to subset taxa info with obs indexes and visa versa, which does not make sense:For example:
....
and
...
I think either a warning should be issued or the function should do its best to convert between taxon indexes and obs indexes when possible and error when not.
For example,
ex_taxmap$obs("info", value = "taxon_names")
could look up the taxon_names associated with the observations indexes, assuming ataxon_id
column exists inex_taxmap$data$info
.Also,
ex_taxmap$supertaxa(value = "n_legs")
could look for rows inex_taxmap$data$info
assigned to taxa in the output ofsupertaxa
and use then_legs
values there. This would returnNA
for taxa not inex_taxmap$data$info
and error if there is more than one entry per taxon, which would be common in many situations.