29
R, twitteR and igraph Just-In Time Sociology @EPFL Yannick Rochat 1,2,3 , Martin Grandjean 2,3 , Vincent Barbay 3,4 1 DHLab, EPFL, 2 UNIL, 3 Pegasus Data Project, 4 OZWE, Lausanne December 4, 2012

Just-In Time Sociology @EPFL€¦ · Twitter API API = Application Programming Interface dev.twitter.com good coding skills needed REST API Streaming API OAuth JSON 9/29. Twitter

  • Upload
    others

  • View
    18

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Just-In Time Sociology @EPFL€¦ · Twitter API API = Application Programming Interface dev.twitter.com good coding skills needed REST API Streaming API OAuth JSON 9/29. Twitter

R, twitteR and igraphJust-In Time Sociology @EPFL

Yannick Rochat1,2,3,Martin Grandjean2,3,Vincent Barbay3,4

1DHLab, EPFL,2 UNIL,3 Pegasus Data Project,4OZWE, Lausanne

December 4, 2012

Page 2: Just-In Time Sociology @EPFL€¦ · Twitter API API = Application Programming Interface dev.twitter.com good coding skills needed REST API Streaming API OAuth JSON 9/29. Twitter

Examples

Twitter

R & twitteR

Just-in time #JITSO12

Conclusion

Page 3: Just-In Time Sociology @EPFL€¦ · Twitter API API = Application Programming Interface dev.twitter.com good coding skills needed REST API Streaming API OAuth JSON 9/29. Twitter

Examples

ContentTweets containing hashtag #EnLD (= En Ligne Directe)

3 / 29

Page 4: Just-In Time Sociology @EPFL€¦ · Twitter API API = Application Programming Interface dev.twitter.com good coding skills needed REST API Streaming API OAuth JSON 9/29. Twitter

Examples

Timestamp0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23

sam 6 oct

ven 5 octRubik

jeu 4 octvente terrain

mer 3 octvaccins

mar 2 octMörgeli

lun 1 octalcool

dim 30 sep

sam 29 sep

ven 28 sep

4 / 29

Page 5: Just-In Time Sociology @EPFL€¦ · Twitter API API = Application Programming Interface dev.twitter.com good coding skills needed REST API Streaming API OAuth JSON 9/29. Twitter

Examples

Predictions (?)

5 / 29

Page 6: Just-In Time Sociology @EPFL€¦ · Twitter API API = Application Programming Interface dev.twitter.com good coding skills needed REST API Streaming API OAuth JSON 9/29. Twitter

Examples

Mentions (network)

6 / 29

Page 7: Just-In Time Sociology @EPFL€¦ · Twitter API API = Application Programming Interface dev.twitter.com good coding skills needed REST API Streaming API OAuth JSON 9/29. Twitter

Examples

Twitter

R & twitteR

Just-in time #JITSO12

Conclusion

Page 8: Just-In Time Sociology @EPFL€¦ · Twitter API API = Application Programming Interface dev.twitter.com good coding skills needed REST API Streaming API OAuth JSON 9/29. Twitter

Twitter

Twitter 3rd-party appsA few examples. . .

• TweetBackup

• Tweet Archivist

• Topsy

• Yahoo pipes (RSS)• IFTTT.com

• i.e. online scripts that can send archives toevernote, dropbox, etc.

8 / 29

Page 9: Just-In Time Sociology @EPFL€¦ · Twitter API API = Application Programming Interface dev.twitter.com good coding skills needed REST API Streaming API OAuth JSON 9/29. Twitter

Twitter

API

• API = Application Programming Interface

• dev.twitter.com• good coding skills needed

• REST API• Streaming API• OAuth• JSON

9 / 29

Page 10: Just-In Time Sociology @EPFL€¦ · Twitter API API = Application Programming Interface dev.twitter.com good coding skills needed REST API Streaming API OAuth JSON 9/29. Twitter

Twitter

APIA sample of PHP code used by the Pegasus Data Project

10 / 29

Page 11: Just-In Time Sociology @EPFL€¦ · Twitter API API = Application Programming Interface dev.twitter.com good coding skills needed REST API Streaming API OAuth JSON 9/29. Twitter

Twitter

APIJSON (output format)

11 / 29

Page 12: Just-In Time Sociology @EPFL€¦ · Twitter API API = Application Programming Interface dev.twitter.com good coding skills needed REST API Streaming API OAuth JSON 9/29. Twitter

Examples

Twitter

R & twitteR

Just-in time #JITSO12

Conclusion

Page 13: Just-In Time Sociology @EPFL€¦ · Twitter API API = Application Programming Interface dev.twitter.com good coding skills needed REST API Streaming API OAuth JSON 9/29. Twitter

R & twitteR

Installhttp://r-project.org

13 / 29

Page 14: Just-In Time Sociology @EPFL€¦ · Twitter API API = Application Programming Interface dev.twitter.com good coding skills needed REST API Streaming API OAuth JSON 9/29. Twitter

R & twitteR

As Quora says...

I R is a data analysis software.

I R is a programming language.

I R is an environment for statistical analysis.

I R is an open-source software project.

I R is a worldwide community of statisticians,

data analysts and data scientists.

http://www.quora.com/R-software/What-is-R/

answer/David-Smith-3114 / 29

Page 15: Just-In Time Sociology @EPFL€¦ · Twitter API API = Application Programming Interface dev.twitter.com good coding skills needed REST API Streaming API OAuth JSON 9/29. Twitter

R & twitteR

Strong community

I Developers

I Users

I Forums, mailing-lists

I #rstats

I quora, stackoverflow

15 / 29

Page 16: Just-In Time Sociology @EPFL€¦ · Twitter API API = Application Programming Interface dev.twitter.com good coding skills needed REST API Streaming API OAuth JSON 9/29. Twitter

R & twitteR

InstalltwitteR

Installing is necessary only once.

Loading1 has to be done every session, or once for all via package options.

1library()16 / 29

Page 17: Just-In Time Sociology @EPFL€¦ · Twitter API API = Application Programming Interface dev.twitter.com good coding skills needed REST API Streaming API OAuth JSON 9/29. Twitter

R & twitteR

searchTwitter

17 / 29

Page 18: Just-In Time Sociology @EPFL€¦ · Twitter API API = Application Programming Interface dev.twitter.com good coding skills needed REST API Streaming API OAuth JSON 9/29. Twitter

R & twitteR

searchTwitter

18 / 29

Page 19: Just-In Time Sociology @EPFL€¦ · Twitter API API = Application Programming Interface dev.twitter.com good coding skills needed REST API Streaming API OAuth JSON 9/29. Twitter

R & twitteR

searchTwitter

19 / 29

Page 20: Just-In Time Sociology @EPFL€¦ · Twitter API API = Application Programming Interface dev.twitter.com good coding skills needed REST API Streaming API OAuth JSON 9/29. Twitter

R & twitteR

searchTwitterMore generally. . .

20 / 29

Page 21: Just-In Time Sociology @EPFL€¦ · Twitter API API = Application Programming Interface dev.twitter.com good coding skills needed REST API Streaming API OAuth JSON 9/29. Twitter

R & twitteR

list → data frames

21 / 29

Page 22: Just-In Time Sociology @EPFL€¦ · Twitter API API = Application Programming Interface dev.twitter.com good coding skills needed REST API Streaming API OAuth JSON 9/29. Twitter

Examples

Twitter

R & twitteR

Just-in time #JITSO12

Conclusion

Page 23: Just-In Time Sociology @EPFL€¦ · Twitter API API = Application Programming Interface dev.twitter.com good coding skills needed REST API Streaming API OAuth JSON 9/29. Twitter

Just-in time #JITSO12

ContentWord cloud

23 / 29

Page 24: Just-In Time Sociology @EPFL€¦ · Twitter API API = Application Programming Interface dev.twitter.com good coding skills needed REST API Streaming API OAuth JSON 9/29. Twitter

Just-in time #JITSO12

Timestamp

24 / 29

Page 25: Just-In Time Sociology @EPFL€¦ · Twitter API API = Application Programming Interface dev.twitter.com good coding skills needed REST API Streaming API OAuth JSON 9/29. Twitter

Just-in time #JITSO12

NetworkWho mentions whom ?

25 / 29

Page 26: Just-In Time Sociology @EPFL€¦ · Twitter API API = Application Programming Interface dev.twitter.com good coding skills needed REST API Streaming API OAuth JSON 9/29. Twitter

Just-in time #JITSO12

Others directions

I Cascades / trends / diffusion

I Text mining

I Dynamics

I Prediction

I Geolocation

I . . .

26 / 29

Page 27: Just-In Time Sociology @EPFL€¦ · Twitter API API = Application Programming Interface dev.twitter.com good coding skills needed REST API Streaming API OAuth JSON 9/29. Twitter

Examples

Twitter

R & twitteR

Just-in time #JITSO12

Conclusion

Page 28: Just-In Time Sociology @EPFL€¦ · Twitter API API = Application Programming Interface dev.twitter.com good coding skills needed REST API Streaming API OAuth JSON 9/29. Twitter

Conclusion

References

I Csardi G, Nepusz T, The igraph software packagefor complex network research, InterJournal,Complex Systems 1695. 2006.http://igraph.sf.net

I Gentry J, twitteR: R based Twitter client. Rpackage version 0.99.19. 2012.http://CRAN.R-project.org/package=twitteR

I Grandjean M, Rochat Y, Barbay V, The PegasusData Project. 2012. http://pegasusdata.com

28 / 29

Page 29: Just-In Time Sociology @EPFL€¦ · Twitter API API = Application Programming Interface dev.twitter.com good coding skills needed REST API Streaming API OAuth JSON 9/29. Twitter