AtlasOfLivingAustralia / ALA4R

Access data and resources hosted by the Atlas of Living Australia (ALA)
https://atlasoflivingaustralia.github.io/ALA4R/
42 stars 8 forks source link

species_info error - dimensions dropped #11

Closed johnbaums closed 9 years ago

johnbaums commented 9 years ago

For some taxa (maybe largely constrained to those without "proper" guids?), species_info fails to return the record.

e.g. for http://bie.ala.org.au/ws/species/ALA_Caladenia_cardiochila

> species_info(guid='ALA_Caladenia_cardiochila')
Error in subset.default(out$classification, select = tempcols) : 
  argument "subset" is missing, with no default
> species_info('Caladenia cardiochila')
Error in subset.default(out$classification, select = tempcols) : 
  argument "subset" is missing, with no default

Similarly for ALA_Pterostylis_squamata.

Seems that in species_info, out[[k]] = out[[k]][, tempcols] needs to be out[[k]] = out[[k]][, tempcols, drop=FALSE] to accommodate these, since e.g. family is the only field present in $classification.

raymondben commented 9 years ago

Thanks, well spotted, fixed in v1.17. I hadn't previously seen taxa with that sort of improper classificaton. For those taxa, the returned classification is just a string, not a data.frame. I've avoided the error, but it does mean that the returned result$classification object is just a string, not a data.frame as it is for taxa with proper classifications. But I don't see any easy way of fixing this at the R end, it would require the underlying ALA taxonomic information to be corrected.

johnbaums commented 9 years ago

Nice one, thanks for the explanation.

On Wednesday, 27 May 2015, Ben Raymond notifications@github.com wrote:

Thanks, well spotted, fixed in v1.17. I hadn't previously seen taxa with that sort of improper classificaton. For those taxa, the returned classification is just a string, not a data.frame. I've avoided the error, but it does mean that the returned result$classification object is just a string, not a data.frame as it is for taxa with proper classifications. But I don't see any easy way of fixing this at the R end, it would require the underlying ALA taxonomic information to be corrected.

— Reply to this email directly or view it on GitHub https://github.com/AtlasOfLivingAustralia/ALA4R/issues/11#issuecomment-105743331 .

raymondben commented 9 years ago

Minor update in v1.18: the result$classification object in these cases will now be a data.frame (though with only one column and one row). Note that this change may affect other elements of the result object that were previously single-element string or numeric, because they will now also be left as single-element data.frames.