Throughout this document we’ll use the rtweet
package (link) to retrieve Twitter data from its API. Its use is quite straightforward once the authentication steps are completed…
All instructions on how to set up application and oauth are gathered here: (http://rtweet.info/articles/auth.html)
I have stored my secret access info in a git-ignored script…
source("twitter_token_creation.R")
twitter_token <- create_token(
app =my_app ,
consumer_key = my_API_key,
consumer_secret = my_API_secret,
access_token=my_access_token,
access_secret=my_access_token_secret
)
Now we are ready to start gathering twitter info
We can access tweets published during the last 7 days based on a keywords search (you can find out details about search rules here:
tib_tweets <- search_tweets("(flat OR house) (sale OR sell OR selling)", n=500)
dim(tib_tweets)
## [1] 468 88
There are no less than 88 variables related to these tweets.
The number of tweet returned by default is 100… You can get many more than that if you settle on a broad keywords search… Beware of not exceeding the rate limit, though!
The object returned by search_tweets()
is actually a nested tibble, that allows for multiple information to be stored for one tweet (i.e. multiple urls , multiple mentions of Twitter users in a single tweet, etc.): this means that some columns are not vectors, but lists:
str(tib_tweets,max.level=1)
## Classes 'tbl_df', 'tbl' and 'data.frame': 468 obs. of 88 variables:
## $ user_id : chr "966305713109852160" "2570041618" "20920286" "859382889175273472" ...
## $ status_id : chr "1020332970077548544" "1020332936548188160" "1020332923025846272" "1020332900062040067" ...
## $ created_at : POSIXct, format: "2018-07-20 15:41:51" "2018-07-20 15:41:43" ...
## $ screen_name : chr "lucy_hdh_Oxford" "ma_mortgages" "martyndix" "strong_opinions" ...
## $ text : chr "Tickets now on sale for masquerade ball to benefit Helen and Douglas House hospice charity - https://t.co/ZF7s1"| __truncated__ "Selling a house? 8 steps for making a big first impression https://t.co/na1ws763ze https://t.co/8bDmpGWJlT" "@BrexitCentral @andreajenkyns If I sell my house, I wonder if the buyer would mind me holding on to the Back Door Key?" "If it doesn’t have subway tiles, is it even a house (for sale in a gentrified neighborhood)?" ...
## $ source : chr "Twitter Lite" "Social Media Publisher App " "Twitter for Android" "Twitter for iPhone" ...
## $ display_text_width : num 140 82 136 92 23 140 247 123 123 84 ...
## $ reply_to_status_id : chr NA NA NA NA ...
## $ reply_to_user_id : chr NA NA NA NA ...
## $ reply_to_screen_name : chr NA NA NA NA ...
## $ is_quote : logi FALSE FALSE FALSE FALSE FALSE FALSE ...
## $ is_retweet : logi TRUE FALSE TRUE FALSE FALSE TRUE ...
## $ favorite_count : int 0 0 0 0 0 0 0 0 0 0 ...
## $ retweet_count : int 2 0 2 0 0 36 0 3542 3542 0 ...
## $ hashtags :List of 468
## $ symbols :List of 468
## $ urls_url :List of 468
## $ urls_t.co :List of 468
## $ urls_expanded_url :List of 468
## $ media_url :List of 468
## $ media_t.co :List of 468
## $ media_expanded_url :List of 468
## $ media_type :List of 468
## $ ext_media_url :List of 468
## $ ext_media_t.co :List of 468
## $ ext_media_expanded_url :List of 468
## $ ext_media_type : chr NA NA NA NA ...
## $ mentions_user_id :List of 468
## $ mentions_screen_name :List of 468
## $ lang : chr "en" "en" "en" "en" ...
## $ quoted_status_id : chr NA NA NA NA ...
## $ quoted_text : chr NA NA NA NA ...
## $ quoted_created_at : POSIXct, format: NA NA ...
## $ quoted_source : chr NA NA NA NA ...
## $ quoted_favorite_count : int NA NA NA NA NA NA NA NA NA NA ...
## $ quoted_retweet_count : int NA NA NA NA NA NA NA NA NA NA ...
## $ quoted_user_id : chr NA NA NA NA ...
## $ quoted_screen_name : chr NA NA NA NA ...
## $ quoted_name : chr NA NA NA NA ...
## $ quoted_followers_count : int NA NA NA NA NA NA NA NA NA NA ...
## $ quoted_friends_count : int NA NA NA NA NA NA NA NA NA NA ...
## $ quoted_statuses_count : int NA NA NA NA NA NA NA NA NA NA ...
## $ quoted_location : chr NA NA NA NA ...
## $ quoted_description : chr NA NA NA NA ...
## $ quoted_verified : logi NA NA NA NA NA NA ...
## $ retweet_status_id : chr "1019244403498643462" NA "1019551328266326016" NA ...
## $ retweet_text : chr "Tickets now on sale for masquerade ball to benefit Helen and Douglas House hospice charity - https://t.co/ZF7s1"| __truncated__ NA "@BrexitCentral @andreajenkyns If I sell my house, I wonder if the buyer would mind me holding on to the Back Door Key?" NA ...
## $ retweet_created_at : POSIXct, format: "2018-07-17 15:36:17" NA ...
## $ retweet_source : chr "Swindon Link Social Auto Post" NA "Twitter for iPhone" NA ...
## $ retweet_favorite_count : int 0 NA 13 NA NA 74 NA 9973 9973 NA ...
## $ retweet_retweet_count : int 2 NA 2 NA NA 36 NA 3542 3542 NA ...
## $ retweet_user_id : chr "51685991" NA "58818345" NA ...
## $ retweet_screen_name : chr "swindonlink" NA "gray_jones26" NA ...
## $ retweet_name : chr "Swindon Link" NA "<f0><U+009F><U+0087><U+00AC><f0><U+009F><U+0087><U+00A7>Graham Jones <f0><U+009F><U+008F><U+00B4><f3><U+00A0><U"| __truncated__ NA ...
## $ retweet_followers_count: int 8557 NA 297 NA NA 185240 NA 2848 2848 NA ...
## $ retweet_friends_count : int 2310 NA 516 NA NA 160858 NA 651 651 NA ...
## $ retweet_statuses_count : int 20689 NA 11262 NA NA 58975 NA 33553 33553 NA ...
## $ retweet_location : chr "Swindon, UK" NA "Windsor" NA ...
## $ retweet_description : chr "Site for #SwindonLink magazine, the best read publication in the town. On paper, mobile and online #Swindon #Ne"| __truncated__ NA "Please do not add me to any lists without prior, explicit approval by myself alone. I voted Leave!!!" NA ...
## $ retweet_verified : logi FALSE NA FALSE NA NA TRUE ...
## $ place_url : chr NA NA NA NA ...
## $ place_name : chr NA NA NA NA ...
## $ place_full_name : chr NA NA NA NA ...
## $ place_type : chr NA NA NA NA ...
## $ country : chr NA NA NA NA ...
## $ country_code : chr NA NA NA NA ...
## $ geo_coords :List of 468
## $ coords_coords :List of 468
## $ bbox_coords :List of 468
## $ status_url : chr "https://twitter.com/lucy_hdh_Oxford/status/1020332970077548544" "https://twitter.com/ma_mortgages/status/1020332936548188160" "https://twitter.com/martyndix/status/1020332923025846272" "https://twitter.com/strong_opinions/status/1020332900062040067" ...
## $ name : chr "Lucy Walker" "Josh Thielen - JT22" "Martyn Dix <f0><U+009F><U+0087><U+00AC><f0><U+009F><U+0087><U+00A7>" "Rosie Tobin" ...
## $ location : chr "Oxford, England" "Massachusetts, USA" "" "Grand Rapids, MI" ...
## $ description : chr "Community Fundraising Manager for @HelenAndDouglas- covering Central Oxford." "Embodies a zest for life & helping others, as well as mortgage financing, credit & entrepreneurship. \nI believ"| __truncated__ "UKIP member. PM May has to go." "Does the internet need more opinions? Yes, mine." ...
## $ url : chr "https://t.co/xECLadMh0H" "https://t.co/1j149000cJ" NA NA ...
## $ protected : logi FALSE FALSE FALSE FALSE FALSE FALSE ...
## $ followers_count : int 141 38 100 30 482 185240 3610 531 1266 31 ...
## $ friends_count : int 506 212 76 116 902 160858 3948 503 861 67 ...
## $ listed_count : int 5 1 1 1 34 634 247 6 22 0 ...
## $ statuses_count : int 202 716 6565 132 58109 58975 317134 27706 82746 308 ...
## $ favourites_count : int 76 830 6665 141 2462 566 77900 23144 4871 10 ...
## $ account_created_at : POSIXct, format: "2018-02-21 13:36:49" "2014-05-29 01:20:20" ...
## $ verified : logi FALSE FALSE FALSE FALSE FALSE TRUE ...
## $ profile_url : chr "https://t.co/xECLadMh0H" "https://t.co/1j149000cJ" NA NA ...
## $ profile_expanded_url : chr "https://www.helenanddouglas.org.uk/" "http://www.facebook.com/jtmortgages" NA NA ...
## $ account_lang : chr "en" "en" "en" "en" ...
## $ profile_banner_url : chr "https://pbs.twimg.com/profile_banners/966305713109852160/1519220558" "https://pbs.twimg.com/profile_banners/2570041618/1520197669" "https://pbs.twimg.com/profile_banners/20920286/1531982172" "https://pbs.twimg.com/profile_banners/859382889175273472/1493729436" ...
## $ profile_background_url : chr "http://abs.twimg.com/images/themes/theme1/bg.png" "http://abs.twimg.com/images/themes/theme1/bg.png" "http://abs.twimg.com/images/themes/theme1/bg.png" "http://abs.twimg.com/images/themes/theme1/bg.png" ...
## $ profile_image_url : chr "http://pbs.twimg.com/profile_images/966306987720966144/wrfIvUHA_normal.jpg" "http://pbs.twimg.com/profile_images/859425780358676481/QyyEDOgO_normal.jpg" "http://pbs.twimg.com/profile_images/1019833262389284864/L2CBdG0m_normal.jpg" "http://pbs.twimg.com/profile_images/859387642257002496/-8cjF5wx_normal.jpg" ...
I select some relevant, not-too-sparse variables just to display the kind of data we get out of search_tweets()
tib_tweets %>%
filter(lang=="en") %>%
select(screen_name,
text,
created_at,
location)
## # A tibble: 451 x 4
## screen_name text created_at location
## <chr> <chr> <dttm> <chr>
## 1 lucy_hdh_Oxford Tickets now on sale for m~ 2018-07-20 15:41:51 Oxford,~
## 2 ma_mortgages Selling a house? 8 steps ~ 2018-07-20 15:41:43 Massach~
## 3 martyndix @BrexitCentral @andreajen~ 2018-07-20 15:41:40 ""
## 4 strong_opinions If it doesn’t have subway~ 2018-07-20 15:41:34 Grand R~
## 5 DmvMusicPlug "Everyone know MD's @Endl~ 2018-07-20 15:41:07 DMV
## 6 KulganofCrydee "Well done to the solicit~ 2018-07-20 15:40:52 Hinckle~
## 7 jawsuhlynn If you shop at Urban Outf~ 2018-07-20 15:40:52 Houston~
## 8 uchebaby_ If you shop at Urban Outf~ 2018-07-20 15:40:43 Chicago~
## 9 JulieBonebrake Preparing a house for sal~ 2018-07-20 15:40:43 Frederi~
## 10 ABBUKA "Learn About Earth's Near~ 2018-07-20 15:40:21 CHICAGO
## # ... with 441 more rows
map_lgl(tib_tweets$geo_coords,~is.na(.x[1])) %>%
table()
## .
## FALSE TRUE
## 6 462
The tweets are very seldomly located (variable geo_coords
). On the other hand Twitter accounts often come with some information regarding location:
tib_tweets %>%
select(location) %>%
sample_n(30)
## # A tibble: 30 x 1
## location
## <chr>
## 1 Chicago, IL
## 2 Detroit/ Windsor
## 3 ""
## 4 ""
## 5 St. John's, Newfoundland
## 6 Leesburg, VA
## 7 Los Angeles
## 8 ""
## 9 Houston, TX
## 10 London
## # ... with 20 more rows
These character strings related to location might or might not really make sense as geographical data… Anyway we can run some geocoding function to try and make them correspond to geographical coordinates:
Here I use Data Science Toolkit (“dsk”) as source:
library(ggmap)
geocode("NY",source="dsk", output="all")
## $status
## [1] "OK"
##
## $results
## $results[[1]]
## $results[[1]]$geometry
## $results[[1]]$geometry$location_type
## [1] "APPROXIMATE"
##
## $results[[1]]$geometry$location
## $results[[1]]$geometry$location$lng
## [1] -75.4999
##
## $results[[1]]$geometry$location$lat
## [1] 43.00035
##
##
## $results[[1]]$geometry$viewport
## $results[[1]]$geometry$viewport$southwest
## $results[[1]]$geometry$viewport$southwest$lng
## [1] -79.76259
##
## $results[[1]]$geometry$viewport$southwest$lat
## [1] 40.4774
##
##
## $results[[1]]$geometry$viewport$northeast
## $results[[1]]$geometry$viewport$northeast$lng
## [1] -71.77749
##
## $results[[1]]$geometry$viewport$northeast$lat
## [1] 45.01586
##
##
##
##
## $results[[1]]$types
## [1] "administrative_area_level_1" "political"
##
## $results[[1]]$address_components
## $results[[1]]$address_components[[1]]
## $results[[1]]$address_components[[1]]$types
## [1] "administrative_area_level_1" "political"
##
## $results[[1]]$address_components[[1]]$short_name
## [1] "New York"
##
## $results[[1]]$address_components[[1]]$long_name
## [1] "New York, US"
##
##
## $results[[1]]$address_components[[2]]
## $results[[1]]$address_components[[2]]$types
## [1] "country" "political"
##
## $results[[1]]$address_components[[2]]$short_name
## [1] "US"
##
## $results[[1]]$address_components[[2]]$long_name
## [1] "United States"
The direct result of a call to function geocode()
is quite messy so I tailored a function that extracts just the few pieces of information I need as a table:
completeWithCoords=function(df){
locs=data.frame(location=unique(df$location),
stringsAsFactors=FALSE)
locs=locs$location
locations=locs %>%
map(safely(geocode),source="dsk", output="all") %>%
map("result") %>%
map("results")
coords=locations %>%
map(1) %>%
map("geometry") %>%
map("location") %>%
map(unlist) %>%
map(function(x){if(is.null(x)) x=c(lng=NA,lat=NA) else x=x})
coords=do.call(rbind,coords)
comp=locations %>%
map(1) %>%
map("address_components") %>%
map(function(x){map(x,safely(as.data.frame),stringsAsFactors=FALSE )}) %>%
map(function(x) map(x,"result")) %>%
map(function(x){do.call(rbind,x)})
country=comp %>%
map(safely(function(x){filter(x,types=="country")})) %>%
map("result") %>%
map("long_name") %>%
map(function(x){if(is.null(x)) x=NA else x=x}) %>%
unlist()
locality=comp %>%
map(safely(function(x){filter(x,types=="locality")}
)) %>%
map("result") %>%
map("short_name") %>%
map(function(x){if(is.null(x)) x=NA else x=x}) %>%
unlist()
area=comp %>%
map(safely(function(x){filter(x,types=="administrative_area_level_1")}
)) %>%
map("result") %>%
map("short_name") %>%
map(function(x){if(is.null(x)) x=NA else x=x}) %>%
unlist()
coords=data.frame(location=locs,
coords,
country,
locality,
area,
stringsAsFactors=FALSE)
df=left_join(df,coords,by="location")
return(df)
}
This function takes a table with column location
and completes it with coordinates (latitude-longitude), country, locality, area.
tib_trial <- tibble(location=c("NY",
"NYC",
"California, baby!",
"Midland, TX",
"Port Harcourt, Nigeria",
"All around the world!",
"Montmartre",
"La butte Montmartre",
"Quartier Latin",
"20 rue Mérieux Lyon"))
completeWithCoords(tib_trial)
## # A tibble: 10 x 6
## location lng lat country locality area
## <chr> <dbl> <dbl> <chr> <chr> <chr>
## 1 NY - 75.5 43.0 United Stat~ <NA> New Y~
## 2 NYC - 74.0 40.7 United Stat~ New York <NA>
## 3 California, baby! -120 36.2 United Stat~ <NA> CA
## 4 Midland, TX -102 32.0 United Stat~ Midland TX
## 5 Port Harcourt, Nigeria 7.01 4.78 Nigeria Port Harcourt <NA>
## 6 All around the world! 55.2 25.2 United Arab~ <NA> <NA>
## 7 Montmartre -103 50.2 Canada Montmartre <NA>
## 8 La butte Montmartre 2.34 48.9 France Paris 18 Butt~ <NA>
## 9 Quartier Latin 2.34 48.9 France <NA> <NA>
## 10 20 rue Mérieux Lyon 4.85 45.7 France Lyon <NA>
str(lookup_users("realtyWW"))
## Classes 'tbl_df', 'tbl' and 'data.frame': 1 obs. of 88 variables:
## $ user_id : chr "710444019311091712"
## $ status_id : chr "1020317983342657536"
## $ created_at : POSIXct, format: "2018-07-20 14:42:18"
## $ screen_name : chr "realtyWW"
## $ text : chr "2 Bed Flat To Rent In West London, London https://t.co/2nFnGCImQU https://t.co/HqJCMyd5X7"
## $ source : chr "dlvr.it"
## $ display_text_width : int NA
## $ reply_to_status_id : logi NA
## $ reply_to_user_id : logi NA
## $ reply_to_screen_name : logi NA
## $ is_quote : logi FALSE
## $ is_retweet : logi FALSE
## $ favorite_count : int 0
## $ retweet_count : int 0
## $ hashtags :List of 1
## ..$ : chr NA
## $ symbols :List of 1
## ..$ : chr NA
## $ urls_url :List of 1
## ..$ : chr "realtyww.info/apartments/fla…"
## $ urls_t.co :List of 1
## ..$ : chr "https://t.co/2nFnGCImQU"
## $ urls_expanded_url :List of 1
## ..$ : chr "https://realtyww.info/apartments/flats/2-bed-flat-to-rent-in-west-london-london_i1926620?utm_source=dlvr.it&utm_medium=twitter"
## $ media_url :List of 1
## ..$ : chr "http://pbs.twimg.com/media/DijlzEKVMAEHsEZ.jpg"
## $ media_t.co :List of 1
## ..$ : chr "https://t.co/HqJCMyd5X7"
## $ media_expanded_url :List of 1
## ..$ : chr "https://twitter.com/realtyWW/status/1020317983342657536/photo/1"
## $ media_type :List of 1
## ..$ : chr "photo"
## $ ext_media_url :List of 1
## ..$ : chr "http://pbs.twimg.com/media/DijlzEKVMAEHsEZ.jpg"
## $ ext_media_t.co :List of 1
## ..$ : chr "https://t.co/HqJCMyd5X7"
## $ ext_media_expanded_url :List of 1
## ..$ : chr "https://twitter.com/realtyWW/status/1020317983342657536/photo/1"
## $ ext_media_type : chr NA
## $ mentions_user_id :List of 1
## ..$ : chr NA
## $ mentions_screen_name :List of 1
## ..$ : chr NA
## $ lang : chr "en"
## $ quoted_status_id : chr NA
## $ quoted_text : chr NA
## $ quoted_created_at : POSIXct, format: NA
## $ quoted_source : chr NA
## $ quoted_favorite_count : int NA
## $ quoted_retweet_count : int NA
## $ quoted_user_id : chr NA
## $ quoted_screen_name : chr NA
## $ quoted_name : chr NA
## $ quoted_followers_count : int NA
## $ quoted_friends_count : int NA
## $ quoted_statuses_count : int NA
## $ quoted_location : chr NA
## $ quoted_description : chr NA
## $ quoted_verified : logi NA
## $ retweet_status_id : chr NA
## $ retweet_text : chr NA
## $ retweet_created_at : POSIXct, format: NA
## $ retweet_source : chr NA
## $ retweet_favorite_count : int NA
## $ retweet_retweet_count : int NA
## $ retweet_user_id : chr NA
## $ retweet_screen_name : chr NA
## $ retweet_name : chr NA
## $ retweet_followers_count: int NA
## $ retweet_friends_count : int NA
## $ retweet_statuses_count : int NA
## $ retweet_location : chr NA
## $ retweet_description : chr NA
## $ retweet_verified : logi NA
## $ place_url : chr NA
## $ place_name : chr NA
## $ place_full_name : chr NA
## $ place_type : chr NA
## $ country : chr NA
## $ country_code : chr NA
## $ geo_coords :List of 1
## ..$ : num NA NA
## $ coords_coords :List of 1
## ..$ : num NA NA
## $ bbox_coords :List of 1
## ..$ : num NA NA NA NA NA NA NA NA
## $ status_url : chr "https://twitter.com/NA/status/1020317983342657536"
## $ name : chr "realtyWW"
## $ location : chr ""
## $ description : chr "Free international real estate classifieds website"
## $ url : chr "https://t.co/hGZnHaCABY"
## $ protected : logi FALSE
## $ followers_count : int 778
## $ friends_count : int 4
## $ listed_count : int 9
## $ statuses_count : int 184341
## $ favourites_count : int 0
## $ account_created_at : POSIXct, format: "2016-03-17 12:33:48"
## $ verified : logi FALSE
## $ profile_url : chr "https://t.co/hGZnHaCABY"
## $ profile_expanded_url : chr "http://realtyww.info/"
## $ account_lang : chr "ru"
## $ profile_banner_url : chr "https://pbs.twimg.com/profile_banners/710444019311091712/1493805308"
## $ profile_background_url : chr "http://abs.twimg.com/images/themes/theme1/bg.png"
## $ profile_image_url : chr "http://pbs.twimg.com/profile_images/859707772635668480/VMs_4bT0_normal.jpg"
str(get_followers("realtyWW"))
## Classes 'tbl_df', 'tbl' and 'data.frame': 778 obs. of 1 variable:
## $ user_id: chr "968880811314475008" "939628607470792705" "1854868530" "1018834465055965187" ...
## - attr(*, "next_cursor")= chr "0"
str(get_friends("realtyWW"))
## Classes 'tbl_df', 'tbl' and 'data.frame': 4 obs. of 2 variables:
## $ user : chr "realtyWW" "realtyWW" "realtyWW" "realtyWW"
## $ user_id: chr "576056458" "1380451" "15134782" "61268528"
## - attr(*, "next_cursor")= int 0
We can retrieve the tweets in the timeline of one Twitter-user. In that case the information retrieval is not limited to a certain time-window, but is limited to a certain number of tweets of the timeline (up to 3200).
Here we just retrieve 100 (the default number) tweets of user @realtyWW:
timeline <- get_timeline("@realtyWW")
dim(timeline)
## [1] 100 88
Again, the number of variables is quite overwhelming:
str(timeline, max.level=1)
## Classes 'tbl_df', 'tbl' and 'data.frame': 100 obs. of 88 variables:
## $ user_id : chr "710444019311091712" "710444019311091712" "710444019311091712" "710444019311091712" ...
## $ status_id : chr "1020317983342657536" "1020317978636632064" "1020317974702436353" "1020317970482933760" ...
## $ created_at : POSIXct, format: "2018-07-20 14:42:18" "2018-07-20 14:42:17" ...
## $ screen_name : chr "realtyWW" "realtyWW" "realtyWW" "realtyWW" ...
## $ text : chr "2 Bed Flat To Rent In West London, London https://t.co/2nFnGCImQU https://t.co/HqJCMyd5X7" "2 Bed Flat To Rent In South London, London https://t.co/jHooUcXAuY https://t.co/9HM16cIR4o" "2 Bed Flat To Rent In Colindale, London https://t.co/ifoDDJKia4 https://t.co/HdnLjDWsPu" "Studio To Rent In West London, London https://t.co/dNSPNMmVTT https://t.co/XXdEPd8oc7" ...
## $ source : chr "dlvr.it" "dlvr.it" "dlvr.it" "dlvr.it" ...
## $ display_text_width : num 65 66 63 61 64 64 65 71 66 73 ...
## $ reply_to_status_id : logi NA NA NA NA NA NA ...
## $ reply_to_user_id : logi NA NA NA NA NA NA ...
## $ reply_to_screen_name : logi NA NA NA NA NA NA ...
## $ is_quote : logi FALSE FALSE FALSE FALSE FALSE FALSE ...
## $ is_retweet : logi FALSE FALSE FALSE FALSE FALSE FALSE ...
## $ favorite_count : int 0 0 0 0 0 0 0 0 0 0 ...
## $ retweet_count : int 0 0 0 0 0 0 0 0 0 0 ...
## $ hashtags :List of 100
## $ symbols :List of 100
## $ urls_url :List of 100
## $ urls_t.co :List of 100
## $ urls_expanded_url :List of 100
## $ media_url :List of 100
## $ media_t.co :List of 100
## $ media_expanded_url :List of 100
## $ media_type :List of 100
## $ ext_media_url :List of 100
## $ ext_media_t.co :List of 100
## $ ext_media_expanded_url :List of 100
## $ ext_media_type : chr NA NA NA NA ...
## $ mentions_user_id :List of 100
## $ mentions_screen_name :List of 100
## $ lang : chr "en" "en" "en" "en" ...
## $ quoted_status_id : chr NA NA NA NA ...
## $ quoted_text : chr NA NA NA NA ...
## $ quoted_created_at : POSIXct, format: NA NA ...
## $ quoted_source : chr NA NA NA NA ...
## $ quoted_favorite_count : int NA NA NA NA NA NA NA NA NA NA ...
## $ quoted_retweet_count : int NA NA NA NA NA NA NA NA NA NA ...
## $ quoted_user_id : chr NA NA NA NA ...
## $ quoted_screen_name : chr NA NA NA NA ...
## $ quoted_name : chr NA NA NA NA ...
## $ quoted_followers_count : int NA NA NA NA NA NA NA NA NA NA ...
## $ quoted_friends_count : int NA NA NA NA NA NA NA NA NA NA ...
## $ quoted_statuses_count : int NA NA NA NA NA NA NA NA NA NA ...
## $ quoted_location : chr NA NA NA NA ...
## $ quoted_description : chr NA NA NA NA ...
## $ quoted_verified : logi NA NA NA NA NA NA ...
## $ retweet_status_id : chr NA NA NA NA ...
## $ retweet_text : chr NA NA NA NA ...
## $ retweet_created_at : POSIXct, format: NA NA ...
## $ retweet_source : chr NA NA NA NA ...
## $ retweet_favorite_count : int NA NA NA NA NA NA NA NA NA NA ...
## $ retweet_retweet_count : int NA NA NA NA NA NA NA NA NA NA ...
## $ retweet_user_id : chr NA NA NA NA ...
## $ retweet_screen_name : chr NA NA NA NA ...
## $ retweet_name : chr NA NA NA NA ...
## $ retweet_followers_count: int NA NA NA NA NA NA NA NA NA NA ...
## $ retweet_friends_count : int NA NA NA NA NA NA NA NA NA NA ...
## $ retweet_statuses_count : int NA NA NA NA NA NA NA NA NA NA ...
## $ retweet_location : chr NA NA NA NA ...
## $ retweet_description : chr NA NA NA NA ...
## $ retweet_verified : logi NA NA NA NA NA NA ...
## $ place_url : chr NA NA NA NA ...
## $ place_name : chr NA NA NA NA ...
## $ place_full_name : chr NA NA NA NA ...
## $ place_type : chr NA NA NA NA ...
## $ country : chr NA NA NA NA ...
## $ country_code : chr NA NA NA NA ...
## $ geo_coords :List of 100
## $ coords_coords :List of 100
## $ bbox_coords :List of 100
## $ status_url : chr "https://twitter.com/realtyWW/status/1020317983342657536" "https://twitter.com/realtyWW/status/1020317978636632064" "https://twitter.com/realtyWW/status/1020317974702436353" "https://twitter.com/realtyWW/status/1020317970482933760" ...
## $ name : chr "realtyWW" "realtyWW" "realtyWW" "realtyWW" ...
## $ location : chr "" "" "" "" ...
## $ description : chr "Free international real estate classifieds website" "Free international real estate classifieds website" "Free international real estate classifieds website" "Free international real estate classifieds website" ...
## $ url : chr "https://t.co/hGZnHaCABY" "https://t.co/hGZnHaCABY" "https://t.co/hGZnHaCABY" "https://t.co/hGZnHaCABY" ...
## $ protected : logi FALSE FALSE FALSE FALSE FALSE FALSE ...
## $ followers_count : int 778 778 778 778 778 778 778 778 778 778 ...
## $ friends_count : int 4 4 4 4 4 4 4 4 4 4 ...
## $ listed_count : int 9 9 9 9 9 9 9 9 9 9 ...
## $ statuses_count : int 184341 184341 184341 184341 184341 184341 184341 184341 184341 184341 ...
## $ favourites_count : int 0 0 0 0 0 0 0 0 0 0 ...
## $ account_created_at : POSIXct, format: "2016-03-17 12:33:48" "2016-03-17 12:33:48" ...
## $ verified : logi FALSE FALSE FALSE FALSE FALSE FALSE ...
## $ profile_url : chr "https://t.co/hGZnHaCABY" "https://t.co/hGZnHaCABY" "https://t.co/hGZnHaCABY" "https://t.co/hGZnHaCABY" ...
## $ profile_expanded_url : chr "http://realtyww.info/" "http://realtyww.info/" "http://realtyww.info/" "http://realtyww.info/" ...
## $ account_lang : chr "ru" "ru" "ru" "ru" ...
## $ profile_banner_url : chr "https://pbs.twimg.com/profile_banners/710444019311091712/1493805308" "https://pbs.twimg.com/profile_banners/710444019311091712/1493805308" "https://pbs.twimg.com/profile_banners/710444019311091712/1493805308" "https://pbs.twimg.com/profile_banners/710444019311091712/1493805308" ...
## $ profile_background_url : chr "http://abs.twimg.com/images/themes/theme1/bg.png" "http://abs.twimg.com/images/themes/theme1/bg.png" "http://abs.twimg.com/images/themes/theme1/bg.png" "http://abs.twimg.com/images/themes/theme1/bg.png" ...
## $ profile_image_url : chr "http://pbs.twimg.com/profile_images/859707772635668480/VMs_4bT0_normal.jpg" "http://pbs.twimg.com/profile_images/859707772635668480/VMs_4bT0_normal.jpg" "http://pbs.twimg.com/profile_images/859707772635668480/VMs_4bT0_normal.jpg" "http://pbs.twimg.com/profile_images/859707772635668480/VMs_4bT0_normal.jpg" ...
timeline %>%
select(screen_name,
text,
created_at)
## # A tibble: 100 x 3
## screen_name text created_at
## * <chr> <chr> <dttm>
## 1 realtyWW 2 Bed Flat To Rent In West London, Lon~ 2018-07-20 14:42:18
## 2 realtyWW 2 Bed Flat To Rent In South London, Lo~ 2018-07-20 14:42:17
## 3 realtyWW 2 Bed Flat To Rent In Colindale, Londo~ 2018-07-20 14:42:16
## 4 realtyWW Studio To Rent In West London, London ~ 2018-07-20 14:42:15
## 5 realtyWW Residential For Sale In Markham, Ontar~ 2018-07-20 14:42:14
## 6 realtyWW 2 Bed Flat To Rent In East London, Ess~ 2018-07-20 14:42:13
## 7 realtyWW 2 Bed Flat To Rent In East London, Lon~ 2018-07-20 14:42:12
## 8 realtyWW 2 Bed Flat To Rent In Birmingham, West~ 2018-07-20 14:42:10
## 9 realtyWW 2 Bed Flat To Rent In North London, Lo~ 2018-07-20 14:42:09
## 10 realtyWW Studio To Rent In Harrow (london Borou~ 2018-07-20 14:42:07
## # ... with 90 more rows
get_trends("Lyon") %>%
kable()
trend | url | promoted_content | query | tweet_volume | place | woeid | as_of | created_at |
---|---|---|---|---|---|---|---|---|
#Benalla | http://twitter.com/search?q=%23Benalla | NA | %23Benalla | 66659 | Lyon | 609125 | 2018-07-20 15:42:28 | 2018-07-20 15:37:21 |
#TonicInfo | http://twitter.com/search?q=%23TonicInfo | NA | %23TonicInfo | NA | Lyon | 609125 | 2018-07-20 15:42:28 | 2018-07-20 15:37:21 |
#TousauxBalcons | http://twitter.com/search?q=%23TousauxBalcons | NA | %23TousauxBalcons | NA | Lyon | 609125 | 2018-07-20 15:42:28 | 2018-07-20 15:37:21 |
#TDF2018 | http://twitter.com/search?q=%23TDF2018 | NA | %23TDF2018 | 64715 | Lyon | 609125 | 2018-07-20 15:42:28 | 2018-07-20 15:37:21 |
#innovation | http://twitter.com/search?q=%23innovation | NA | %23innovation | 21540 | Lyon | 609125 | 2018-07-20 15:42:28 | 2018-07-20 15:37:21 |
José Fonte | http://twitter.com/search?q=%22Jos%C3%A9+Fonte%22 | NA | %22Jos%C3%A9+Fonte%22 | NA | Lyon | 609125 | 2018-07-20 15:42:28 | 2018-07-20 15:37:21 |
Booba | http://twitter.com/search?q=Booba | NA | Booba | 14823 | Lyon | 609125 | 2018-07-20 15:42:28 | 2018-07-20 15:37:21 |
Adama Diakhaby | http://twitter.com/search?q=%22Adama+Diakhaby%22 | NA | %22Adama+Diakhaby%22 | NA | Lyon | 609125 | 2018-07-20 15:42:28 | 2018-07-20 15:37:21 |
Sadio Mané | http://twitter.com/search?q=%22Sadio+Man%C3%A9%22 | NA | %22Sadio+Man%C3%A9%22 | 18796 | Lyon | 609125 | 2018-07-20 15:42:28 | 2018-07-20 15:37:21 |
Ferrand | http://twitter.com/search?q=Ferrand | NA | Ferrand | NA | Lyon | 609125 | 2018-07-20 15:42:28 | 2018-07-20 15:37:21 |
Vinicius Junior | http://twitter.com/search?q=%22Vinicius+Junior%22 | NA | %22Vinicius+Junior%22 | 15183 | Lyon | 609125 | 2018-07-20 15:42:28 | 2018-07-20 15:37:21 |
Jean-Louis Trintignant | http://twitter.com/search?q=%22Jean-Louis+Trintignant%22 | NA | %22Jean-Louis+Trintignant%22 | NA | Lyon | 609125 | 2018-07-20 15:42:28 | 2018-07-20 15:37:21 |
Goutte | http://twitter.com/search?q=Goutte | NA | Goutte | NA | Lyon | 609125 | 2018-07-20 15:42:28 | 2018-07-20 15:37:21 |
Le TAS | http://twitter.com/search?q=%22Le+TAS%22 | NA | %22Le+TAS%22 | NA | Lyon | 609125 | 2018-07-20 15:42:28 | 2018-07-20 15:37:21 |
République | http://twitter.com/search?q=R%C3%A9publique | NA | R%C3%A9publique | 38042 | Lyon | 609125 | 2018-07-20 15:42:28 | 2018-07-20 15:37:21 |
Christophe Dugarry | http://twitter.com/search?q=%22Christophe+Dugarry%22 | NA | %22Christophe+Dugarry%22 | NA | Lyon | 609125 | 2018-07-20 15:42:28 | 2018-07-20 15:37:21 |
Nibali | http://twitter.com/search?q=Nibali | NA | Nibali | 25594 | Lyon | 609125 | 2018-07-20 15:42:28 | 2018-07-20 15:37:21 |
Broly | http://twitter.com/search?q=Broly | NA | Broly | 97873 | Lyon | 609125 | 2018-07-20 15:42:28 | 2018-07-20 15:37:21 |
Marianne | http://twitter.com/search?q=Marianne | NA | Marianne | NA | Lyon | 609125 | 2018-07-20 15:42:28 | 2018-07-20 15:37:21 |
Froome | http://twitter.com/search?q=Froome | NA | Froome | 16096 | Lyon | 609125 | 2018-07-20 15:42:28 | 2018-07-20 15:37:21 |
France Ô | http://twitter.com/search?q=%22France+%C3%94%22 | NA | %22France+%C3%94%22 | NA | Lyon | 609125 | 2018-07-20 15:42:28 | 2018-07-20 15:37:21 |
Geraint Thomas | http://twitter.com/search?q=%22Geraint+Thomas%22 | NA | %22Geraint+Thomas%22 | NA | Lyon | 609125 | 2018-07-20 15:42:28 | 2018-07-20 15:37:21 |
Bruno Roger-Petit | http://twitter.com/search?q=%22Bruno+Roger-Petit%22 | NA | %22Bruno+Roger-Petit%22 | NA | Lyon | 609125 | 2018-07-20 15:42:28 | 2018-07-20 15:37:21 |
#soldes | http://twitter.com/search?q=%23soldes | NA | %23soldes | 18067 | Lyon | 609125 | 2018-07-20 15:42:28 | 2018-07-20 15:37:21 |
#VendrediLecture | http://twitter.com/search?q=%23VendrediLecture | NA | %23VendrediLecture | NA | Lyon | 609125 | 2018-07-20 15:42:28 | 2018-07-20 15:37:21 |
#Tomorrowland | http://twitter.com/search?q=%23Tomorrowland | NA | %23Tomorrowland | NA | Lyon | 609125 | 2018-07-20 15:42:28 | 2018-07-20 15:37:21 |
#PremierLeague | http://twitter.com/search?q=%23PremierLeague | NA | %23PremierLeague | NA | Lyon | 609125 | 2018-07-20 15:42:28 | 2018-07-20 15:37:21 |
#JeepELITE | http://twitter.com/search?q=%23JeepELITE | NA | %23JeepELITE | NA | Lyon | 609125 | 2018-07-20 15:42:28 | 2018-07-20 15:37:21 |
#SMCHAC | http://twitter.com/search?q=%23SMCHAC | NA | %23SMCHAC | NA | Lyon | 609125 | 2018-07-20 15:42:28 | 2018-07-20 15:37:21 |
#DujeEstOlympien | http://twitter.com/search?q=%23DujeEstOlympien | NA | %23DujeEstOlympien | 11024 | Lyon | 609125 | 2018-07-20 15:42:28 | 2018-07-20 15:37:21 |
#Nightflyers | http://twitter.com/search?q=%23Nightflyers | NA | %23Nightflyers | NA | Lyon | 609125 | 2018-07-20 15:42:28 | 2018-07-20 15:37:21 |
#SIGEM | http://twitter.com/search?q=%23SIGEM | NA | %23SIGEM | NA | Lyon | 609125 | 2018-07-20 15:42:28 | 2018-07-20 15:37:21 |
#DCUniverse | http://twitter.com/search?q=%23DCUniverse | NA | %23DCUniverse | 15056 | Lyon | 609125 | 2018-07-20 15:42:28 | 2018-07-20 15:37:21 |
#AffaireMacron | http://twitter.com/search?q=%23AffaireMacron | NA | %23AffaireMacron | NA | Lyon | 609125 | 2018-07-20 15:42:28 | 2018-07-20 15:37:21 |
#PekinExpress | http://twitter.com/search?q=%23PekinExpress | NA | %23PekinExpress | 28114 | Lyon | 609125 | 2018-07-20 15:42:28 | 2018-07-20 15:37:21 |
#WestWebFestival | http://twitter.com/search?q=%23WestWebFestival | NA | %23WestWebFestival | NA | Lyon | 609125 | 2018-07-20 15:42:28 | 2018-07-20 15:37:21 |
#LesNapoleons | http://twitter.com/search?q=%23LesNapoleons | NA | %23LesNapoleons | NA | Lyon | 609125 | 2018-07-20 15:42:28 | 2018-07-20 15:37:21 |
#AHSApocalypse | http://twitter.com/search?q=%23AHSApocalypse | NA | %23AHSApocalypse | 19552 | Lyon | 609125 | 2018-07-20 15:42:28 | 2018-07-20 15:37:21 |
#charrues18 | http://twitter.com/search?q=%23charrues18 | NA | %23charrues18 | NA | Lyon | 609125 | 2018-07-20 15:42:28 | 2018-07-20 15:37:21 |
#VigilanceOrange | http://twitter.com/search?q=%23VigilanceOrange | NA | %23VigilanceOrange | NA | Lyon | 609125 | 2018-07-20 15:42:28 | 2018-07-20 15:37:21 |
#recrutement | http://twitter.com/search?q=%23recrutement | NA | %23recrutement | NA | Lyon | 609125 | 2018-07-20 15:42:28 | 2018-07-20 15:37:21 |
#PalaceDay | http://twitter.com/search?q=%23PalaceDay | NA | %23PalaceDay | NA | Lyon | 609125 | 2018-07-20 15:42:28 | 2018-07-20 15:37:21 |
#8YearsOfOneDirection | http://twitter.com/search?q=%238YearsOfOneDirection | NA | %238YearsOfOneDirection | 360983 | Lyon | 609125 | 2018-07-20 15:42:28 | 2018-07-20 15:37:21 |
#AllianzSports2018 | http://twitter.com/search?q=%23AllianzSports2018 | NA | %23AllianzSports2018 | NA | Lyon | 609125 | 2018-07-20 15:42:28 | 2018-07-20 15:37:21 |
#DanceToThis | http://twitter.com/search?q=%23DanceToThis | NA | %23DanceToThis | 83817 | Lyon | 609125 | 2018-07-20 15:42:28 | 2018-07-20 15:37:21 |
#Madeleine2018 | http://twitter.com/search?q=%23Madeleine2018 | NA | %23Madeleine2018 | NA | Lyon | 609125 | 2018-07-20 15:42:28 | 2018-07-20 15:37:21 |