Skip to content

Instantly share code, notes, and snippets.

@yoshihara
Created April 6, 2014 12:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yoshihara/10005383 to your computer and use it in GitHub Desktop.
Save yoshihara/10005383 to your computer and use it in GitHub Desktop.
skypeのdbを解析して選択したグループチャット内の人別発言数をグラフにする ref: http://qiita.com/yshr04hrk/items/5c23bc458855052c748d
options(repos="http://cran.md.tsukuba.ac.jp")
install.packages("DBI")
install.packages("RSQLite")
source("/path/to/one_room_skype_graph.r")
db_path = "~/Library/Application Support/Skype/(skypeID)/main.db"
library(RSQLite)
driver <- dbDriver("SQLite")
con <- dbConnect(driver, db_path)
convo <- dbGetQuery(con, "SELECT id, displayname from Conversations where type = 2")
id = menu(c(convo$displayname), title="0:exit")
if (id == c(0)) { cat("Nothing done\n")
} else {
convo_id = convo[id, 'id']
tbl <- dbGetQuery(con, paste("SELECT m.author, m.id, c.displayname from Messages m inner join Conversations c on m.convo_id = c.id where c.type = 2 and c.id = ", convo_id, " order by m.author"))
res <- tapply(tbl[,"id"], tbl[,"author"], length)
par(mar=c(15,4,4,4))
barplot(sort(res, decreasing=T), las=3, family="Osaka",cex.axis=0.7, cex=0.5)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment