1

私はtwitteRRでライブラリを使用していますが、検索に関連付けられたタイムスタンプまたはタイムラインを取得できるかどうか疑問に思っています。例えば、searchTwitter を使用して #rstats を検索する場合、ツイートがいつ作成されたかを知りたいのですが...その情報を取得するために解析する必要がある追加のパラメーターはありますか?

ここにいくつかのサンプルコードがあります...

library(twitteR)
searchTwitter("#rstats",n=10)

次の結果を与える

[[1]]
[1] "MinneAnalytics: @thomaswdinsmore RT @erikriverson: Some thoughts from an observer on the #Rstats track at #BigDataMN. http://t.co/i42PEQHz #R at #CSOM"

[[2]]
[1] "pentalibra: My package ggdendro to draw dendrograms with ggplot2 is back on CRAN. http://t.co/gMviOSnQ Wait a day or so for Windows binary/ #rstats"

[[3]]
[1] "Lachamadice: RT @freakonometrics: \"Regression tree using Gini's index\" http://t.co/tUplMqQj with #rstats"

[[4]]
[1] "Rbloggers: Tracking Number of Historical Clusters: \n(This article was first published on   Systematic Investor » R,... http://t.co/jRnWUQ2Y #rstats"

[[5]]
[1] "Rbloggers: ggplot2 multiple boxplots with metadata: \n(This article was first published on   mintgene » R, and kindl... http://t.co/re2gghTx #rstats"

[[6]]
[1] "Rbloggers: Learning R using a Chemical Reaction Engineering Book: Part 3: \n(This article was first published on   N... http://t.co/agCJi9Rr #rstats"

[[7]]
[1] "Rbloggers: Learning R using a Chemical Reaction Engineering Book: Part 2: \n(This article was first published on   N... http://t.co/2qqpgQrq #rstats"

[[8]]
[1] "Rbloggers: Waiting for an API request to complete: \n(This article was first published on   Recology - R, and kindly... http://t.co/MZzxHVdw #rstats"

[[9]]
[1] "heidelqekhse3: RT @geospacedman: Just got an openlayers map working on an #rstats #shiny app at #nhshd but... meh."

[[10]]
[1] "jveik: Slides and replay of “Using R with Hadoop” webinar now available #rstats #hadoop | @scoopit http://t.co/Ar2F7We3"
4

2 に答える 2

4

グーグルの後:

 mytweet <- searchTwitter("#chocolate",n=10)
 str(mytweet[[1]])

Reference class 'status' [package "twitteR"] with 10 fields
 $ text        : chr "The #chocolate part of the #croquette. #dumplings #truffles http://t.co/Imwt3tTP"
 $ favorited   : logi FALSE
 $ replyToSN   : chr(0) 
 $ created     : POSIXct[1:1], format: "2013-01-27 16:26:03"
 $ truncated   : logi FALSE
 $ replyToSID  : chr(0) 
 $ id          : chr "295568362526896128"
 $ replyToUID  : chr(0) 
 $ statusSource: chr "&lt;a href=&quot;http://instagr.am&quot;&gt;Instagram&lt;/a&gt;"
 $ screenName  : chr "tahiatmahboob"
 and 33 methods, of which 22 are possibly relevant:
   getCreated, getFavorited, getId, getReplyToSID, getReplyToSN, getReplyToUID, getScreenName, getStatusSource, getText, getTruncated,
   initialize, setCreated, setFavorited, setId, setReplyToSID, setReplyToSN, setReplyToUID, setScreenName, setStatusSource, setText,
   setTruncated, toDataFrame

したがって、タイムスタンプは次のとおりです。

mytweet[[1]]$created
[1] "2013-01-27 16:26:03 UTC"

twitteRあなたの質問を読むまでは使用しませんでした。退屈したときに何かをするのは楽しいようです。

于 2013-01-27T16:27:46.193 に答える
1

(上記の回答のように) 結果を解析する 1 つの代替手段は、引数sinceおよびuntilを使用することです。

たとえば、次のことができます。

 res <- searchTwitter("#rstats",n=1000,since='2013-01-24',
                                       until='2013-01-28')

searchTwitter、twitter の JSON API へのラッパーです。引数の詳細と JSON 結果の例については、こちらをご覧ください。

于 2013-01-27T16:37:01.623 に答える