Created
April 6, 2014 12:32
-
-
Save yoshihara/10005383 to your computer and use it in GitHub Desktop.
skypeのdbを解析して選択したグループチャット内の人別発言数をグラフにする ref: http://qiita.com/yshr04hrk/items/5c23bc458855052c748d
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
options(repos="http://cran.md.tsukuba.ac.jp") | |
install.packages("DBI") | |
install.packages("RSQLite") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source("/path/to/one_room_skype_graph.r") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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