Reputation: 127
I am intending on translating simple text in string variables in datasets with R. I have looked at the translateR package but following the example in the help file I stumbled across the need for a Google API access.
This is not a free service as I have become aware. There are other APIS (Bing for example) but I guess there is no way in R to get to it?
Any ideas on how to mass translate certain string data in a data frame? Or what I could look into?
Upvotes: 1
Views: 4982
Reputation: 54237
It's all in the manual: ?translateR::translate
:
To use the Microsoft API, a client id and a client secret value must be provided. For more information on getting these, see http://msdn.microsoft.com/en-us/library/hh454950.aspx. NOTE: you do not need to obtain an access token. translateR will retrieve a token internally.
library(translateR)
res <- translate(content.vec = c("Hello world.", "This is a test."),
microsoft.client.id = "foo_id",
microsoft.client.secret = "fdsg54345_bar_secret_560985lkfdasd",
source.lang = "en",
target.lang = "de")
res
# [1] "Hallo Welt." "Dies ist ein Test."
Upvotes: 2