Skip to content

Commit

Permalink
Update R/countrycode.R
Browse files Browse the repository at this point in the history
Co-authored-by: CJ Yetman <[email protected]>
  • Loading branch information
etiennebacher and cjyetman authored Sep 7, 2023
1 parent 43e4970 commit efa0ff6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions R/countrycode.R
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,9 @@ countrycode <- function(sourcevar, origin, destination, warn = TRUE, nomatch = N
# only apply toupper() on unique values and match after.
# much faster than applying toupper() on the whole vector
# when vector is very large
uniques = unique(origin_vector)
uppercase = toupper(uniques)
origin_vector = unname(uppercase[match(origin_vector, uniques)])
uniques <- unique(origin_vector)
uppercase <- toupper(uniques)
origin_vector <- unname(uppercase[match(origin_vector, uniques)])
}
}

Expand Down

0 comments on commit efa0ff6

Please sign in to comment.