| translate | R Documentation |
Translates relying on https://www.deepl.com/translator.
translate(dataset = NULL,
column.name = NULL,
source.lang = "EN",
target.lang = "DE",
url = "https://www.deepl.com/jsonrpc")
dataset |
A character vector or dataframe (with a column containing the text to be translated). |
column.name |
If a dataframe is passed to "dataset", the name of the column containing the text must be passed to "column.name". |
source.lang |
The language code that corresponds with the language in which the source text is written. One of "EN", "DE", "FR", "ES", "IT", "NL", "PL". Default is "EN". |
target.lang |
The language code that corresponds with the language into which the source text is to be translated. One of "EN", "DE", "FR", "ES", "IT", "NL", "PL". Default is "DE". |
url |
Url to the inofficial DeepL API. |
# Load the package
library(deeplr)
# Translate a single string
dat <- "Essentially, all models are wrong, but some are useful"
translate(dataset = dat)
# Translate a character vector
dat <- c("The only way to find out what happens is to disturb the system",
"The whole problem with the world is that fools are always so certain of themselves")
translate(dataset = dat)
# Translate a column in a dataframe
dat <- data.frame(text = c("The only way to find out what happens is to disturb the system",
"The whole problem with the world is that fools are always so certain of themselves"))
translate(dataset = dat, column.name = "text", source.lang = "EN", target.lang = "ES")
swiss$country <- rownames(swiss)
translate(dataset = swiss, column.name = "country", source.lang = "FR", target.lang = "EN")
# well...
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.