2016-07-04 7 views
0

CRANパッケージstreamRlink hereの例で見つかった以下のコードを実行しようとしていますが、実行時にエラーが発生しています。ご協力いただきありがとうございます。エラー:「filterStream」という関数が見つかりませんでした。なぜこのエラーが発生するのでしょうか?

## Not run: 
## An example of an authenticated request using the ROAuth package, 
## where consumerkey and consumer secret are fictitious. 
## You can obtain your own at dev.twitter.com 
library(ROAuth) 
requestURL <- "https://api.twitter.com/oauth/request_token" 
accessURL <- "https://api.twitter.com/oauth/access_token" 
authURL <- "http://api.twitter.com/oauth/authorize" 
consumerKey <- "xxxxxxxxxxxxxx" 
consumerSecret <- "xxxyyyyyyyyyyyzzzzzzz1111111122222222" 
my_oauth <- OAuthFactory$new(consumerKey=consumerKey, consumerSecret=consumerSecret, requestURL=requestURL, accessURL=accessURL, authURL=authURL) 
my_oauth$handshake(cainfo = system.file("CurlSSL", "cacert.pem", package = "RCurl")) 
filterStream(file="tweets_rstats.json",track="rstats", timeout=3600, oauth=my_oauth) 
## capture 10 tweets mentioning the "Rstats" hashtag 
filterStream(file.name="tweets_rstats.json", track="rstats", tweets=10, oauth=my_oauth) 
## capture tweets published by Twitter's official account 
filterStream(file.name="tweets_twitter.json", follow="783214", timeout=600, oauth=my_oauth) 
## capture tweets sent from New York City in Spanish only, and saving as an object in memory 
tweets <- filterStream(file.name="", language="es",locations=c(-74,40,-73,41), timeout=600, oauth=my_oauth) 
## capture tweets mentioning the "rstats" hashtag or sent from New York City 
filterStream(file="tweets_rstats.json", track="rstats",locations=c(-74,40,-73,41), timeout=600, oauth=my_oauth) 
## End(Not run) 

答えて

0

多分最初filterStreamは、 "my_oauthの$ハンドシェイク" filterStream後(ファイル= "tweets_rstats.json"、= "RSTATS" トラック、タイムアウト= 3600、OAuthの= my_oauth)

が代わりにする必要があります filterStream(file.name = "tweets_rstats.json"、track = "rstats"、timeout = 3600、oauth = my_oauth)

+0

Nopeが動作しないため、リンクを確認してください! – SamAct

+1

あなたは別のライブラリ 'library(streamR)'も読み込みます(これはこの[link](http://pablobarbera.com/blog/archives/1.html)参照) – ddb

0

Twitter AppsにTwitterアプリケーションを登録しましたか? その場合、コールバックURLはhttp://127.0.0.1:1410?に設定しましたか?

どのようなエラーが発生しましたか?私は認証プロセスのいくつかの問題について考えています。filterStreamは、認証を取得してダウンロードを開始するためにmy_oauthを渡す必要があります。

関連する問題