I'm new to R and I'm trying to access Microsoft translator using the translate R package for R. I am able to establish a connection but I get the error :
Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘fromJSON’ for signature ‘"raw", "missing"’
Here is my code:
options( RCurlOptions = list(verbose = TRUE, ssl.verifypeer=TRUE, sslversion=3L,
cainfo="cacert.pem", proxy = "HOST:PORT" ))
translate(
content.vec = swedata,
microsoft.client.id = "my.client.id",
microsoft.client.secret = "my.client.secret",
source.lang = 'sv',
target.lang = 'en')
swedata is a character contaning 26 characters. (Not quite sure how that works)
class(swedata)
[1] "character"
class(swedata[1])
[1] "character"
But on to my main question. Is the package not working propperly or could I some how "insert" the "inherited method for function ‘fromJSON’ for signature "raw", "missing" "?
I apologize in advance if the question is "blurry" as I said, I'm new to R.
Here is a traceback()
9: stop(gettextf("unable to find an inherited method for function %s for signature %s",
sQuote(fdef@generic), sQuote(cnames)), domain = NA)
8: (function (classes, fdef, mtable)
{
methods <- .findInheritedMethods(classes, fdef, mtable)
if (length(methods) == 1L)
return(methods[[1L]])
else if (length(methods) == 0L) {
cnames <- paste0("\"", sapply(classes, as.character),
"\"", collapse = ", ")
stop(gettextf("unable to find an inherited method for function %s for signature %s",
sQuote(fdef@generic), sQuote(cnames)), domain = NA)
}
else stop("Internal error in finding inherited methods; didn't return a unique method",
domain = NA)
})(list("raw", "missing"), function (content, handler = NULL,
default.size = 100, depth = 150L, allowComments = TRUE, asText = isContent(content),
data = NULL, maxChar = c(0L, nchar(content)), simplify = Strict,
nullValue = NULL, simplifyWithNames = TRUE, encoding = NA_character_,
stringFun = NULL, ...)
standardGeneric("fromJSON"), <environment>)
7: fromJSON(postForm("https://datamarket.accesscontrol.windows.net/v2/OAuth2-13",
.params = fields, style = "POST"))
6: getAccessToken(microsoft.client.id, microsoft.client.secret)
5: translate(content.vec = swedata, microsoft.client.id = "my.client.id",
microsoft.client.secret = "my.secret",
source.lang = "sv", target.lang = "en") at .active-rstudio-document#9
4: eval(expr, envir, enclos)
3: eval(ei, envir)
2: withVisible(eval(ei, envir))
1: source("~/.active-rstudio-document", echo = TRUE)