About Robert

Robert Vesco

I'm a doctoral student at the University of Maryland's Robert H. Smith School of Business.

My research interests include understanding (a) why some areas are more entrepreneurial than others, (b) what drives people to pursue entrepreneurship, and (c) collaboration and innovation processes.

You can find my CV here

Using R to Extract Excel/csv File of Citation Data from Zotero

Zotero is a handy piece of software used to manage citations. However, one of issues I have with it is that there is no convenient way to export citation into excel. There are some folks that have put together some solutions here, here, and here, but they haven't been able to accomplish what I needed. Essentially, want I wanted was a way to review my citations, abstracts and a few other details easily. Two things about my solution. One it uses R, so you probably want to have some experience using that software, and two, you may want to have Zotero closed or make a copy of the sqlite file. Sometimes there are locking issues with the database if you try to access it from two different ways at the same time.

10 comments to Using R to Extract Excel/csv File of Citation Data from Zotero

  • Joe

    Thanks Robert.

    You need to update your package loading bit from
    022 reshape(reshape2)
    023 reshape(reshape)

    to

    022 require(reshape2)
    023 require(reshape)

  • Robert Vesco

    Thanks! Not sure how that got in there ;)

  • Wouter

    Thanks, helped me a lot! I had to remove "bookTitle" from line 101 and comment out line 113 to make it work, otherwise it would give an "undefined columns selected" error (perhaps because that field is not used in any of my citations?).

  • Joe

    Wouter, I had to do the same thing as well.

    Robert, I'd like to display some of your code on a site for an R package that I am developing (http://code.google.com/p/r-systematic-review). I use it in addition to some of my functions.

    Can you please get in touch with me?

    Ta,
    Joe

  • Agustin Lobo

    Thanks,
    How could I actually create a subset of my "zotero-current.sqlite"?
    I want to transfer to csv just a selection of my citations, not the whole
    thing.
    Agus

  • James

    I got this error message. Could you help me how to resolve this issue? Thank you.

    dfData <- sqldf(sqlC,, stringsAsFactors = F, dbname=dbZot, method="raw")
    Error in sqliteExecStatement(con, statement, bind.data) :
    RS-DBI driver: (error in statement: no such table: collectionItems)

  • Robert Vesco

    @james do you have any citations in a collection? Or are they all just in your master library? The error is telling you that there is no collectionItems table. I would suggest creating a collection and dropping some cites in their if you haven't already.

    Alternatively, if Zotero removed that table in their latest release, then that would probably also cause that problem.

    If that's the case I would have to investigate, but I don't know when I'll have time to do that next.

  • Dan

    @james @Robert I had the same error message on a first pass. Opened up the SQL file in SQL browser and collectionItems was still there so I don't think it's because of a more recent Zotero release. For some reason when I made a copy of the file and moved it to another directory it solved the problem. Perhaps it was a locking issue as you suggested Robert. Good luck.

  • Thanks a lot for sharing the code Robert. I'm just having a small issue and wonder if you could help me with it. I couldn't find any solution in stackoverflow.

    When I run ddply (line 93), I get the sollwing error:

    'names' attribute [2023] must be the same length as the vector [5]

    Any idea of how to solve this?

  • Robert Vesco

    Hi Rafael,

    This is interesting. I'm not sure what the problem is. Check out debugging in R and trackdown where that error is happening.

    traceback() after the error is sometimes helpful. It may be caused by paste function or ddply function or the summarise function.

Leave a Reply

  

  

  

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">