Skip to content

Instantly share code, notes, and snippets.

@dfalster
Created July 20, 2013 04:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dfalster/6043852 to your computer and use it in GitHub Desktop.
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.
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