ropensci / taxa

taxonomic classes for R
https://docs.ropensci.org/taxa
Other
48 stars 12 forks source link

Add arbitrary data vars to `taxa` #83

Open zachary-foster opened 7 years ago

zachary-foster commented 7 years ago
sckott commented 6 years ago

started working on this in e1f1a8f3bd2df3ff91dbf35de5a8490c59c1c0cd (accidentally used commit message I meant to use for taxize - what should have said was related to this issue)

sckott commented 6 years ago

(work on this is on branch https://github.com/ropensci/taxa/tree/taxize-compat-changes )

@zachary-foster For taxa , hierarchy, etc. How did you image changing these print methods, seems especially hairy since they are arbitrary, so not sure if you imagined printing number of attributes, their names, something else?

zachary-foster commented 6 years ago

Hmmm, I think the best way would be to have multiple "print handler" functions for common types (vectors, tables, functions, etc). These would be in a list named by their target class. If the class of the object is not handled by one of these functions, just its name and class are printed. Maybe its length if it is a list. I think that is how I handled the arbitrary data that can be in taxmap$data.

sckott commented 6 years ago

okay, makes sense

zachary-foster commented 6 years ago

Hi @sckott, I made the print method system I described above for taxmap objects in my most recent commit:

https://github.com/ropensci/taxa/blob/master/R/taxmap--printers.R

I thought it was already set up that way, but I guess I just imagined it. It might be a useful starting point for the taxa attributes printing or it might work for both the taxa and taxmap print methods. Not sure yet

sckott commented 6 years ago

thanks, will take a look