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

Eduard Szöcs szoe8822 at uni-landau.de
Thu Dec 20 15:25:25 CET 2012


Hai Augusto,

thanks for reporting this bug!

I just pushed a fixed version, where NA is returned when the IUCN-API 
does not return anything.
You can install the newest version from github via:

install.packages("devtools")
require(devtools)
install_github("taxize_",  "ropensci")
require(taxize)


Happy holidays,

Eduard


On 12/19/2012 08:29 PM, Sarah Goslee wrote:
> 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
>
> _______________________________________________
> R-sig-ecology mailing list
> R-sig-ecology at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>



More information about the R-sig-ecology mailing list