hurlbertlab / dietdatabase

Creative Commons Zero v1.0 Universal
10 stars 9 forks source link

clean_all_names() error #85

Closed pwinner1 closed 7 years ago

pwinner1 commented 7 years ago

When the clean_all_names() function is used on the Barros_2014 paper, an error appears...

clean = clean_all_names('cleaning/AvianDietDatabase_Barros_2014.txt')

[1] "Scientific_Name 1 out of 12"

Retrieving data for taxon 'Anacardium occidentale'

[1] "Scientific_Name 2 out of 12"

Retrieving data for taxon 'Mangifera indica'

[1] "Scientific_Name 3 out of 12"

Retrieving data for taxon 'Erioteca gracilipes'

Error in if (class(hierarchy)[1] == "logical" | nrow(hierarchy) <= 1) { : argument is of length zero

Looks like this occurs when the name is not in ITIS.

ahhurlbert commented 7 years ago

I think I've fixed this but haven't had a chance to test.

See if it works now, and if so, you can close the issue.

pwinner1 commented 7 years ago

@ahhurlbert After I used this function now, it looks like it treats all of the prey names as problem names (even though they aren't), and in the "cleandb" file, all of the "Prey_Name_ITIS_ID" are "unverified".

ahhurlbert commented 7 years ago

Try it now. The function now checks for the nrow(hierarchy) instead of nrow(hierarchy[[1]]) which was causing the problem I think.

pwinner1 commented 7 years ago

@ahhurlbert Did you push the changes you made to the function? I am still getting all the names as unmatched in the bad names file.

ahhurlbert commented 7 years ago

Oops. Try now.

pwinner1 commented 7 years ago

looks good now