View source: R/translate_vec.R
| translate_vec | R Documentation |
Translates a character vector.
translate_vec(dataset = NULL, source.lang = "DE", target.lang = "EN", add.source.lang = FALSE, auth_key = NULL, url = "https://api.deepl.com/v2/translate?text=")
dataset |
A character vector. |
source.lang |
Source language. Either "detect" or one of "EN", "FR", etc. |
target.lang |
Target language. One of "EN", "FR", etc. |
add.source.lang |
A logical. If TRUE adds the preset or detected language for each translation. FALSE (default) adds nothing. |
auth_key |
Your API key. |
url |
Url to DeepL API. |
A character vector. If add.source.lang = TRUE a dataframe with an additional column "source_lang".
## Not run:
dat <- c("La seule facon de savoir ce qui se passe est de perturber le systeme.",
"The whole problem with the world is that fools are always so certain of themselves")
# Without language detection and without adding set/detected source language.
translate_vec(dataset = dat,
source.lang = "EN",
target.lang = "DE",
auth_key = "enter you auth key here")
dat <- c("A dog.",
"Un chien.",
"Un perro.",
"Un cane.",
"Een hond.")
# With language detection and with adding set/detected source language.
translate_vec(dataset = dat,
source.lang = "detect",
target.lang = "DE",
add.source.lang = TRUE,
auth_key = "enter you auth key here")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.