Created
July 20, 2013 04:22
-
-
Save dfalster/6043852 to your computer and use it in GitHub Desktop.
An R script to extract a list of journal names for the articles in my zotero library.
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
library("RSQLite") | |
# connect to zotero database | |
pathToZotero <- "~/Zotero" # change this for your setup | |
m <- dbDriver("SQLite") | |
con <- dbConnect(m, file.path(pathToZotero, "zotero.sqlite")) | |
# extract list of journals | |
out <- dbGetQuery(con, "SELECT itemDataValues.value FROM itemDataValues JOIN itemData on itemDataValues.valueID = itemData.valueID WHERE itemData.fieldID = 12")[,1] | |
# Sort in order from most read to least | |
count <- sort(table(out), decreasing=TRUE) | |
# View top 30 | |
head(count, 30) | |
# plot | |
plot(count, xlim=c(1,50), type='l', xaxs="i", yaxs="i", xlab = "rank") | |
dbDisconnect(con) | |
# print unique list of journal names to file | |
write.csv(sort(unique(out)), "journal_names.csv") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment