[R-sig-eco] Problem with function iucn_summary() of taxize package, returning error in strsplit()

Sarah Goslee sarah.goslee at gmail.com
Wed Dec 19 20:29:32 CET 2012


Hi Augusto,

I took a quick look at the code for iucn_summary, and it looks like a bug to me.

I copied the package maintainer on this reply, as is appropriate for
problems with a particular package.

It looks like:
pop <- xpathSApply(h, "//div[@id=\"population\"]/text()[preceding-sibling::br]",
                xmlValue)

is returning an empty list, which then throws an error in the next line:
pop <- do.call(rbind, lapply(strsplit(pop, split = ":"),
                rbind))


It looks like the function works well for complete cases, but has
problems with certain missing/different data (easy mistake I've
committed myself a time or two). You've hit on one of those fringe
cases by accident, and it should be an easy update to the package.

Sarah

On Wed, Dec 19, 2012 at 2:15 PM, Augusto Ribas <ribas.aca at gmail.com> wrote:
> Hello
>
> I'm using the package taxize and was trying to use the function
> iucn_summary() but it work perfectly  with the examples, but when i
> try another name i receive the error msg:
>
> #####
>> iucn_summary("Molossus currentium")
> Erro em strsplit(pop, split = ":") : argumento modo não caractere
> ######
>
> My r is in Portuguese, but it say argument mode not a character.
>
> I checked this specie on iucn site and its there, dunno what is the problem.
>
>
> the examples i cite are:
>
> #
> library(taxize)
>
> iucn_summary("Lynx lynx")
>
> iucn_summary("aaaa")
>
> iucn_summary("Molossus currentium")
> #
>
> first two work properly, but the third give an error.. i have no idea
> of what i'm doing wrong.
>
> I'm using ubunto here, with R 2.15.2 from emacs.
>
> Thanks for the attention.
>
> --
> Grato
> Augusto C. A. Ribas
>

--
Sarah Goslee
http://www.functionaldiversity.org



More information about the R-sig-ecology mailing list