jesstytam / honours

0 stars 0 forks source link

common name matching encoding error #21

Closed jesstytam closed 3 years ago

jesstytam commented 3 years ago

resolve error "No encoding supplied: defaulting to UTF-8." or rinat common name matching

jesstytam commented 3 years ago

get_inat_common_name <- function(scientificname){ a_mac <- get_inat_obs(taxon_name = scientificname, maxresults = 1000) return(names(sort(table(a_mac$species_guess),decreasing = TRUE)[1])) }

commondf <- data.frame() for (i in 1:nrow(combinedf)) { common_name <- tryCatch(get_inat_common_name(combinedf$species[i]), error = function(e) NA) common_name <- data.frame(common_name) commondf <- rbind(commondf, common_name) } #could not get all of the common names; "No encoding supplied: defaulting to UTF-8."

combinedf <- cbind(combinedf, commondf)

jesstytam commented 3 years ago

too hard