I have many Latin name in my database, I want to check them all in rfishbase package and find their common names and put them in to the new column. I did not get success. I got an error. if you have any idea, I would be appreciated. here is the codes
df_sample <- tibble(Latin_name = c("Sparus aurata", "Mullus barbatus", "Belone belone"))
#connect the fisbase database
fishbase_db <- fb_conn(server = c("fishbase", "sealifebase"), version = "latest")
df_sample <- df_sample %>%
rowwise() %>%
mutate(Common_name = {
result <- common_names(Latin_name, db = fishbase_db)
if (nrow(result) > 0) result$CommonName[1] else NA
})
print(df_sample)