Open sebastian-c opened 1 year ago
Here's my workaround function:
Detect <- function(text, auth_key = DEEPL_API_KEY){
text_positions <- which(!is.na(text))
language <- detect2(text[text_positions], auth_key)
new_vec <- rep(NA_character_, length(text))
new_vec[text_positions] <- language
return(new_vec)
}
When detect2 is given NA, it fails before authentication as there's a missing value at the utf8 check. The expected functionality would be to note the position of the NAs and return a vector with translations and the NAs intact in their correct positions.