twitteR サンプル
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
]
開始行:
[[RjpWiki]]
* twitteR サンプル [#l7bb0b1f]
** twitteRとは [#p062b30f]
Rベースののtwitterクライアント
** インストールと読み込み [#o3aef601]
> install.packages("twitteR")
> library("twitteR")
以下、自分以外のIDは伏せてます。
** 認証がいらないAPI [#w958484f]
- public_timeline
> head( publicTimeline() )
[[1]]
[1] "xxxx: @xxxx u jealous or something?"
[[2]]
[1] "xxxx: @xxxx なにこのあいこんかわえええええ!"
[[3]]
[1] "xxxx: RT @xxxx: I need a boyfriend for the month! G...
[[4]]
[1] "xxxx: @xxxx, Ciro vice, o DEM dançou com o cas...
[[5]]
[1] "xxxx: @xxxx how much does it cost to watch?"
[[6]]
[1] "xxxx: @xxxx Cuuuuute!"
- user_timeline
> head( userTimeline("yokkuns") )
[[1]]
[1] "yokkuns: おぉ、これは便利。もうbot作れてしまうな"
[[2]]
[1] "yokkuns: あ、ちゃんとマニュアルあった"
[[3]]
[1] "yokkuns: statusはどうやって取るんだろう"
[[4]]
[1] "yokkuns: 出来た"
[[5]]
[1] "yokkuns: テスト"
[[6]]
[1] "yokkuns: sess <- initSession('myUser', 'myPass')...
** 認証が必要なAPI [#r0768538]
- 初期化
> yokkuns <- initSession("yokkuns","********")
- friends_timeline
> head( friendsTimeline(yokkuns) )
[[1]]
[1] "xxxxxx: 二日酔いけてーいwあぁかえりてぇ"
[[2]]
[1] "xxxxxx: 自分と大して身長の変わらない少年がランドセ...
[[3]]
[1] "xxxxxx: ワンストップ・サービスって取り組みは評価す...
[[4]]
[1] "xxxxxx: ポッポは、年収と月収の違いは理解できてるの...
[[5]]
[1] "xxxxxx: おはようございます。今日はメトロ遅延してい...
[[6]]
[1] "xxxxxx: 寒い。寒すぎる。"
- mentions
> head( mentions(yokkuns) )
[[1]]
[1] "xxxxx: @yokkuns \"R\"に反応。"
[[2]]
[1] "xxxxx: @yokkuns おはっす!寒いですねーー!"
[[3]]
[1] "xxxxx: @yokkuns コーヒー 60円了解しました。先月の食...
[[4]]
[1] "xxxxx: @yokkuns だめ!!!!"
[[5]]
[1] "xxxxx: @yokkuns 歌詞探してねw"
[[6]]
[1] "xxxxx: @yokkuns 特急料金を…(ry 歌詞がない…。"
** statusクラス [#scd6ea49]
返ってくる結果は、statusクラスのオブジェクトのリストにな...
- statusクラスのメソッド
show
text
favorited
replyToSN
created
truncated
replyToSID
id
replyToUID
statusSource
screenName
- 例
> yokkuns_status <- userTimeline("yokkuns")
> yokkuns_status[[1]]
[1] "yokkuns: 3歳児って、もうPC使いこなせるんだなぁ。。。"
> class(yokkuns_status[[1]])[1] "status"
attr(,"package")
[1] "twitteR"
> show(yokkuns_status[[1]])
[1] "yokkuns: 3歳児って、もうPC使いこなせるんだなぁ。。。"
> text(yokkuns_status[[1]])
[1] "3歳児って、もうPC使いこなせるんだなぁ。。。"
> favorited(yokkuns_status[[1]])
[1] FALSE
> replyToSN(yokkuns_status[[1]])
character(0)
> created(yokkuns_status[[1]])
[1] "Sun Dec 20 02:21:33 +0000 2009"
> truncated(yokkuns_status[[1]])
[1] FALSE
> replyToSID(yokkuns_status[[1]])
numeric(0)
> id(yokkuns_status[[1]])
[1] 6847297103
> replyToUID(yokkuns_status[[1]])
numeric(0)
> statusSource(yokkuns_status[[1]])
[1] "<a href=\"http://d.hatena.ne.jp/lynmock/20071107/p2...
> screenName(yokkuns_status[[1]])
[1] "yokkuns"
*関連リンク [#a595aebb]
-[[streamR: Access to Twitter Streaming API via R:http://...
終了行:
[[RjpWiki]]
* twitteR サンプル [#l7bb0b1f]
** twitteRとは [#p062b30f]
Rベースののtwitterクライアント
** インストールと読み込み [#o3aef601]
> install.packages("twitteR")
> library("twitteR")
以下、自分以外のIDは伏せてます。
** 認証がいらないAPI [#w958484f]
- public_timeline
> head( publicTimeline() )
[[1]]
[1] "xxxx: @xxxx u jealous or something?"
[[2]]
[1] "xxxx: @xxxx なにこのあいこんかわえええええ!"
[[3]]
[1] "xxxx: RT @xxxx: I need a boyfriend for the month! G...
[[4]]
[1] "xxxx: @xxxx, Ciro vice, o DEM dançou com o cas...
[[5]]
[1] "xxxx: @xxxx how much does it cost to watch?"
[[6]]
[1] "xxxx: @xxxx Cuuuuute!"
- user_timeline
> head( userTimeline("yokkuns") )
[[1]]
[1] "yokkuns: おぉ、これは便利。もうbot作れてしまうな"
[[2]]
[1] "yokkuns: あ、ちゃんとマニュアルあった"
[[3]]
[1] "yokkuns: statusはどうやって取るんだろう"
[[4]]
[1] "yokkuns: 出来た"
[[5]]
[1] "yokkuns: テスト"
[[6]]
[1] "yokkuns: sess <- initSession('myUser', 'myPass')...
** 認証が必要なAPI [#r0768538]
- 初期化
> yokkuns <- initSession("yokkuns","********")
- friends_timeline
> head( friendsTimeline(yokkuns) )
[[1]]
[1] "xxxxxx: 二日酔いけてーいwあぁかえりてぇ"
[[2]]
[1] "xxxxxx: 自分と大して身長の変わらない少年がランドセ...
[[3]]
[1] "xxxxxx: ワンストップ・サービスって取り組みは評価す...
[[4]]
[1] "xxxxxx: ポッポは、年収と月収の違いは理解できてるの...
[[5]]
[1] "xxxxxx: おはようございます。今日はメトロ遅延してい...
[[6]]
[1] "xxxxxx: 寒い。寒すぎる。"
- mentions
> head( mentions(yokkuns) )
[[1]]
[1] "xxxxx: @yokkuns \"R\"に反応。"
[[2]]
[1] "xxxxx: @yokkuns おはっす!寒いですねーー!"
[[3]]
[1] "xxxxx: @yokkuns コーヒー 60円了解しました。先月の食...
[[4]]
[1] "xxxxx: @yokkuns だめ!!!!"
[[5]]
[1] "xxxxx: @yokkuns 歌詞探してねw"
[[6]]
[1] "xxxxx: @yokkuns 特急料金を…(ry 歌詞がない…。"
** statusクラス [#scd6ea49]
返ってくる結果は、statusクラスのオブジェクトのリストにな...
- statusクラスのメソッド
show
text
favorited
replyToSN
created
truncated
replyToSID
id
replyToUID
statusSource
screenName
- 例
> yokkuns_status <- userTimeline("yokkuns")
> yokkuns_status[[1]]
[1] "yokkuns: 3歳児って、もうPC使いこなせるんだなぁ。。。"
> class(yokkuns_status[[1]])[1] "status"
attr(,"package")
[1] "twitteR"
> show(yokkuns_status[[1]])
[1] "yokkuns: 3歳児って、もうPC使いこなせるんだなぁ。。。"
> text(yokkuns_status[[1]])
[1] "3歳児って、もうPC使いこなせるんだなぁ。。。"
> favorited(yokkuns_status[[1]])
[1] FALSE
> replyToSN(yokkuns_status[[1]])
character(0)
> created(yokkuns_status[[1]])
[1] "Sun Dec 20 02:21:33 +0000 2009"
> truncated(yokkuns_status[[1]])
[1] FALSE
> replyToSID(yokkuns_status[[1]])
numeric(0)
> id(yokkuns_status[[1]])
[1] 6847297103
> replyToUID(yokkuns_status[[1]])
numeric(0)
> statusSource(yokkuns_status[[1]])
[1] "<a href=\"http://d.hatena.ne.jp/lynmock/20071107/p2...
> screenName(yokkuns_status[[1]])
[1] "yokkuns"
*関連リンク [#a595aebb]
-[[streamR: Access to Twitter Streaming API via R:http://...
ページ名: