Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 27 lines (21 sloc) 1.122 kb
b60f54d Escape CSV export strings
Martin Fenner authored
1 # Analysis of crowdometer results: tweets by author/publisher of paper
2 # Version 1.0, 02/19/12
3 # by Martin Fenner <fenner.martin@mh-hannover.de>
4
5 # Import crowdometer result set from figshare
58e7c36 First working version of R script of author classification
Martin Fenner authored
6 #tweets <- read.csv("http://figshare.com/media/download/97336/89546", sep=",")
b60f54d Escape CSV export strings
Martin Fenner authored
7 classifications <- read.csv("http://figshare.com/media/download/97336/89547", sep=",")
8
58e7c36 First working version of R script of author classification
Martin Fenner authored
9 # Combine classifications with tweets, using max value. This will return true
10 # if at least 50% of classifications are true
11 results <- unstack(classifications, form=shares_author~tweet_id)
12 results <- lapply(results, max)
13
14 # Get a vector of the results, turn into table that counts all results
15 results <- table(unlist(results, use.names=FALSE))
b60f54d Escape CSV export strings
Martin Fenner authored
16
17 # Subtitle
58e7c36 First working version of R script of author classification
Martin Fenner authored
18 piesubtitle <- sprintf("%3.0f Tweets", sum(results))
b60f54d Escape CSV export strings
Martin Fenner authored
19
20 # Create label
58e7c36 First working version of R script of author classification
Martin Fenner authored
21 pielabels <- sprintf("%s (%2.0f%s)", names(results), 100*results/sum(results), "%")
b60f54d Escape CSV export strings
Martin Fenner authored
22
23 # Do the plotting
c7a56fa Added delayed_job script
Martin Fenner authored
24 opar <- par(mar=c(2,2,2,2), cex.sub=0.8, cex.main=1.4, fg="black", col.main="#25679a")
898edbb First working version of R script of author classification
Martin Fenner authored
25 pie(results, labels=pielabels, init.angle=130, cex=0.8, lty=1)
b60f54d Escape CSV export strings
Martin Fenner authored
26 title(main="Tweets by Author/Publisher of Paper", sub=piesubtitle, line=-1)
27 par(opar)
Something went wrong with that request. Please try again.