vincentarelbundock / countrycode

R package: Convert country names and country codes. Assigns region descriptors.
https://vincentarelbundock.github.io/countrycode
GNU General Public License v3.0
342 stars 83 forks source link

informative error on NA #263

Closed vincentarelbundock closed 3 years ago

vincentarelbundock commented 3 years ago
countrycode(NA, "genc2c", "country.name")              
Error in countrycode(NA, "genc2c", "country.name") : 
  sourcevar must be a character or numeric vector. This error often
             arises when users pass a tibble (e.g., from dplyr) instead of a
             column vector from a data.frame (i.e., my_tbl[, 2] vs. my_df[, 2]
                                              vs. my_tbl[[2]])