translate_df | R Documentation |
Translates a column in a dataframe.
translate_df(dataset = NULL, column.name = NULL, source.lang = "DE", target.lang = "EN", add.source.lang = FALSE, auth_key = NULL, url = "https://api.deepl.com/v2/translate?text=")
dataset |
Dataframe with column of class character. |
column.name |
Name of column that should be translated. |
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. |
Dataframe with original columns and translated column. add.source.lang = TRUE adds additional column "source_lang".
## Not run: dat <- data.frame(text = 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_df(dataset = dat, column.name = "text", source.lang = "EN", target.lang = "DE", auth_key = "enter you auth key here") dat <- data.frame(text = c("A dog.", "Un chien.", "Un perro.", "Un cane.", "Een hond.")) # With language detection and with adding set/detected source language. translate_df(dataset = dat, column.name = "text", 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.