R twitteR Analysis: How HOT is the Lynas Rare Earths Mining Malaysia?

February 25, 2012
By

(This article was first published on CloudStat, and kindly contributed to R-bloggers)

Since Lynas Malaysia Corporation, Australia Rare Earth Refiner Granted Malaysia License, it is always a very hot topic. This can be proven through the daily tweets across recent 7 days. This chart was built by Tweets Keyword Trending Application @ http://www.cloudstat.org/index.php?do=/kaichew/blog/tweets-keyword-trending-application/

Result:

> xA
[1]  300  293  359  860 1167 1488 1490

Source code:

y <-“lynas” library(twitteR) n=1500
z=1:7

#Today
s0 <- searchTwitter(y, n, since=as.character(Sys.Date()))
x0 <- length(s0) #Yesterday
s1 <- searchTwitter(y, n, since=as.character(Sys.Date()-1), until=as.character(Sys.Date()))
x1 <- length(s1) #Yesterday2
s2 <- searchTwitter(y, n, since=as.character(Sys.Date()-2), until=as.character(Sys.Date()-1))
x2 <- length(s2) #Yesterday3
s3 <- searchTwitter(y, n, since=as.character(Sys.Date()-3), until=as.character(Sys.Date()-2))
x3 <- length(s3) #Yesterday4
s4 <- searchTwitter(y, n, since=as.character(Sys.Date()-4), until=as.character(Sys.Date()-3))
x4 <- length(s4) #Yesterday5
s5 <- searchTwitter(y, n, since=as.character(Sys.Date()-5), until=as.character(Sys.Date()-4))
x5 <- length(s5) #Yesterday6
s6 <- searchTwitter(y, n, since=as.character(Sys.Date()-6), until=as.character(Sys.Date()-5))
x6 <- length(s6) xA <- c(x6, x5, x4, x3, x2, x1, x0) df.bar <- barplot(xA) barplot(xA, main=”How Hot is Lynas Recently?”, xlab=”Days”, 
   ylab=”Total”, names.arg=c(“Yes6”,”Yes5”,”Yes4”,”Yes3”,”Yes2”,”Yes1”,”Today”),
   border=”blue”, density=c(10,20,30,40,50,60,70))
lines(x = df.bar, y = xA, col=”red”)
points(x = df.bar, y = xA, col=”yellow”)
abline(lm(xA~z))
#

Last but not least. Save Malaysia, Stop Lynas!


To leave a comment for the author, please follow the link and comment on their blog: CloudStat.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Tags: , , , ,

Comments are closed.

Sponsors

Mango solutions



RStudio homepage



Zero Inflated Models and Generalized Linear Mixed Models with R

Quantide: statistical consulting and training



http://www.eoda.de







ODSC

ODSC

CRC R books series











Contact us if you wish to help support R-bloggers, and place your banner here.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)