Reputation: 13475
I am using the twitteR
library in R and wondering if is is possible to get timestamps associated with a search or a timeline for that matter. E.G if searching #rstats using searchTwitter, I would like to know when the tweets were made...are there additional parameters I need to parse in order to get that information?
here is some example code...
library(twitteR)
searchTwitter("#rstats",n=10)
giving the following result
[[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"
Upvotes: 1
Views: 2089
Reputation: 121568
One alterantive to parse the result( as the answer above) , is to use argument since and until.
For example you can do :
res <- searchTwitter("#rstats",n=1000,since='2013-01-24',
until='2013-01-28')
The searchTwitter
is a wrapper to the JSON API of twitter. Take a look here for more details of the argument and example of the JSON results.
Upvotes: 1
Reputation: 15441
after a google:
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 "<a href="http://instagr.am">Instagram</a>"
$ 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
So time stamp is:
mytweet[[1]]$created
[1] "2013-01-27 16:26:03 UTC"
Never used twitteR
until I read your question. Seems like something fun to do when bored.
Upvotes: 4