<div>I log all of my books on <a href="https://www.goodreads.com/">Goodreads</a>. On top of that, whenever I hear about a new book I <i>have</i> to read, I add it on Goodreads, so I remember it. Of course, this means my Goodreads bookshelves are a little out of control. Fortunately, I can use R to dig through my Goodreads to-read shelf and figure out the next book to read and/or buy.
<p>If you’re on Goodreads, you can easily download your entire bookshelf, including your to-read books, by going to “My Books” then clicking “Import and Export”. On the right side of the screen will be a link for “Export Library”. Click that and give it a minute (or several). Soon, a link will appear to download your entire library in a CSV file. You can then bring that into R.</p>
<p>If I’m ever stuck for the next book to read, I can use this file to randomly select a book from my to-read list to check out next. Because I own a lot of books on my to-read list, I’d like to filter that dataset to only include books I own. (Note: You can add books to your “owned” list by clicking on “My Books” then “Owned Books” to select which books you already have in your library. Otherwise, you can keep running the sample function until you get a book you already own or have ready access to. You’d just want to skip the “reading_list” part below.)</p>
<div>
<div>
<div>
<pre><span>setwd</span><span>(</span><span>&quot;~/Dropbox&quot;</span><span>)</span><br><span>library</span><span>(tidyverse)</span><br></pre>
</div>
<div>
<pre><span>books</span> <span>&lt;-</span> <span>read_csv</span><span>(</span><span>&quot;goodreads_library_export.csv&quot;</span><span>,</span> <span>col_names</span> <span>=</span> <span>TRUE</span><span>)</span><br></pre>
</div>
<div>
<pre><span>reading_list</span> <span>&lt;-</span> <span>books</span> <span>%>%</span><br>  <span>filter</span><span>(`Owned Copies`</span> <span>==</span> <span>1</span><span>, `Exclusive Shelf`</span> <span>==</span> <span>&quot;to-read&quot;</span><span>)</span><br><span>head</span><span>(reading_list)</span><br></pre>
</div>
<div>
<pre>## # A tibble: 6 x 31<br>##   `Book Id` Title    Author  `Author l-f` `Additional Auth… ISBN    ISBN13<br>##       </pre></div></div></div></div>