Here, I am trying to translate the language of a text by using parallel processing in R. This is the first time I am using Parallel processing. My code is:
install.packages("RYandexTranslate")
install.packages("textcat")
install.packages("plyr")
install.packages("parallel")
library("RYandexTranslate")
library("textcat")
library("dplyr")
library("parallel")
api_key <- "trnsl.1.1.20160707T103515Z.90fa575d702ae81e.6ec78e064eb94a1c00a9bc506c615f223cf0cf5b"
cl <- makeCluster(4)
Query_L_German <- c("5 euro muenze stempelglanz","2 euro muenzen uebersicht")
Par_Conversion <- function(QUery_L_German)
{
for(i in 1:length(Query_L_German))
{
x <- translate(api_key,Query_L_German[i], "de-en")$text
return(x)
}
}
a <- length(Query_L_German)
parLapply(cl, seq(a), function(i,Query_L_German,Par_Conversion)
for(i in 1:length(Query_L_German)){
x <- Par_Conversion(Query_L_German)
return(x)
}, Query_L_German, Par_Conversion)
But, I am getting following error:
Error in checkForRemoteErrors(val) : 3 nodes produced errors; first error: object 'Query_L_German' not found