Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
‘;标志’;不是引用类“;的有效字段或方法名称;OAuth”;在使用twitteR进行R_R_Twitter - Fatal编程技术网

‘;标志’;不是引用类“;的有效字段或方法名称;OAuth”;在使用twitteR进行R

‘;标志’;不是引用类“;的有效字段或方法名称;OAuth”;在使用twitteR进行R,r,twitter,R,Twitter,我正在尝试使用R库twitteR在特定搜索字符串上抓取推文。 我可以很好地进行身份验证,但每当我尝试使用类似 'searchTwitter()' or 'getUser()', 我一直得到一个错误如下 envRefInferField(x,what,getClass(class(x)),selfEnv中出错: “sign”不是引用类“OAuth”的有效字段或方法名 我是R和twitter的新手,有人能解释一下如何解决这个问题吗 我的代码是: load("twitterAuth") use_o

我正在尝试使用R库twitteR在特定搜索字符串上抓取推文。 我可以很好地进行身份验证,但每当我尝试使用类似

 'searchTwitter()' or 'getUser()',
我一直得到一个错误如下

envRefInferField(x,what,getClass(class(x)),selfEnv中出错: “sign”不是引用类“OAuth”的有效字段或方法名

我是R和twitter的新手,有人能解释一下如何解决这个问题吗

我的代码是:

load("twitterAuth")
use_oauth_token(cred)
search_string <- "nba"
no_of_tweets <- 100
tweets<-searchTwitteR("srk")
load(“twitterAuth”)
使用oauth令牌(cred)

搜索字符串我使用推特的方式是

# Credentials
api_key <- "xxxxxxxxxxxxxxxxxxxx"
api_secret <- "xxxxxxxxxxxxxxxxxxxx"
access_token <- "xxxxxxxxxxxxxxxxxxxx"
access_token_secret <- "xxxxxxxxxxxxxxxxxxxx"

setup_twitter_oauth(consumer_key = api_key, 
                    consumer_secret = api_secret, 
                    access_token = access_token, 
                    access_secret = access_token_secret)

tdy <- as.Date("2017-02-11")
mnth <- as.character(seq(from = as.Date("2013-01-31"), to = tdy, by = "month"))
mnth <- c(mnth, as.character(tdy))

for (i in 1:length(mnth) - 1) {
  tmp <- NULL
  i <- 1

  while (any(class(tmp) %in% "error") | is.null(tmp)) {
    tmp <- tryCatch(searchTwitter("#nba", n = 2400, since = "2013-01-31", until = "2013-02-28"), 
                    error = function(e) e,
                    warning = function(w) w)
    save(tmp, file = paste(mnth[i], "___", mnth[i+1], ".RData", sep = ""))
  }

  Sys.sleep(1200)
}
#凭证

api_key我把认证部分搞砸了。以下是我的解决方案:

图书馆(“推特”)

图书馆(“ROAuth”)

图书馆(“RCurl”)

图书馆(“httr”)

包含用于访问Twitter的Twitter应用程序的访问id
非常感谢!结果证明我的方法是错误的。现在工作正常了。@PratikPatra请发布解决方案。