使用R翻译bing错误:签名“raw”,“missing”

时间:2014-12-02 12:22:39

标签: r bing-api

我是R的新手,我正在尝试使用R的translate R软件包访问Microsoft翻译器。我能够建立连接,但是我收到错误:

(函数(classes,fdef,mtable)中的错误:无法为签名'“raw”找到函数'fromJSON'的继承方法,“缺少”'

这是我的代码:

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是一个包含26个字符的角色。 (不太确定它是如何工作的)

class(swedata)
[1] "character"
class(swedata[1])
[1] "character"

但是关于我的主要问题。 包是不正常工作还是我可以“插入”“jSON”的“继承的函数'来签名”raw“,”missing“”?

如果问题像我说的那样“模糊”,我提前道歉,我是R的新手。

这是一个追溯()

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)

0 个答案:

没有答案