Chapter 5 is a web-browser add-on for annotating the web via inline commenting. This allows anyone to select a snippet of text in a web-browser and then post a comment about the selected text. Annotations can be made publicly or privately. All public annotations can be viewed by anyone else running hypothesis on the same website. Using Hypothesis with your web-book allows you to engage students in interacting with the textbook by allowing them to contribute to content generation (by posting new content), or content revision (by tagging sections in need of revision).

If you publish your bookdown book as a webpage, then you anyone with can use it to annotate the textbook.

5.1 A case study example

I recently compiled a Research Methods in Psychology textbook using the tools described in this tutorial. The landing page describes how can be used in conjunction with the textbook.

In class I assigned students the task of downloading, creating a account, and then throughout the course gave them various assignments where they were responsible for annotating parts of the textbook.

For example, in one assignment I had students annotate sections of the textbook that were in need of improvement. This allows students to participate in content revision as they read the textbook. Other assignments could include focused online discussion about textbook content using annotations, or using annotations as a way for students to add content to the textbook.

5.2 hypothesisr

hypothesisr is an r package for scraping annotation data collected through the hypothesis app. All public annotations submitted through hypothesis to any website are publically available for download. As a result, the hypothesisr package can be used to download and process the annotations submitted to your website.

5.3 Hypothesis Explorer

As a part of this project, we have created a Shiny app that conveniently displays and manipulates hypothesis annotation databases in a website. The Shiny app is located in this github repository,

5.3.1 Web-based version

A web-based version of the app can be accessed here: Note the website currently times out after 55 seconds of inactivity. Reload the page to restart the app. This web-version is currently in beta testing.

5.3.2 Running the app locally

To run this app you need to have R and R-Studio installed on your computer. You will also need to have downloaded the Shiny and hypothesisr packages. You can run the app by either of the following methods

  1. You can download the hypothesis_explorer repository as a .zip file, then open the server.r, or ui.r files in R-studio and click run-app

  2. You can have R-studio automatically download and the run app using by entering the following in the command line

shiny::runGitHub('hypothesis_explorer', 'CrumpLab')

5.4 Downloading annotations

The Hypothesis Explorer app currently implements two main functions: downloading and displaying/searching parts of the publicly avialable annotation database.

Download the annotation database associated with a website: Type in the name of the website in the search bar. To see an example, enter “crumplab” into the website search and click the download button.

NOTE OF CAUTION We use the hypothesisr package to scrape parts of the entire annotation database. As a result, there are some nuances in searching for particular websites that may cause you to accidentally download all of the annotations to a global domain rather than to a particular website.

For example, I have two web-books published on my github domain, these are:


I am interested in using the Shiny app to look at only the annotations associated with these two websites. Using “crumplab” as the website will download all of the annotations associated with all subdomains on the site, so it will download annotations for both textbooks. On the other hand, including global domain information by searching “” will cause an attempt to download all annotations associated with the entire github domain, which will cause the Shiny app to crash.

5.5 Viewing the annotations Search and subset the database

Hypothesis explorer should automatically download any annotations associated with the website that you entered. At the moment, we have only tested this for websites built with github pages.

After the annotation database has been downloaded the two viewable tabs “Summary”, and “Data” will be autopopulated. The Summary tab gives an overview of the top annotated documents, pages, tags and users. The Data tab presents the entire database.

5.5.1 Viewing all the variables in the database

The left-hand panel includes a “Variables (in Data View)” text box. Click into the box to see all of the names of each variable (column names) in the database. Clicking one of the variable names will add it to the list, and automatically display the content of that column in the database viewer. Likewise, deleting variable names will hide those columns from being displayed.

5.5.2 Subsetting the data

For quickly collapsing aspects of the data by row information, we have four subsetting operations, for displaying only annotations associated with particular documents (e.g., entire books), pages (chapters within a book), tags (associated with each annotation), and users.

5.5.3 Voting feature

When a user submits an annotation, other users can post comments underneath the annotation. For example, if a student highlights a section of the textbook and comments that this section should be improved, another student could reply to the original comment. We have implemented a rudimentary comment voting system using these features of For example, up/down style voting can be implemented by instructing users to vote by using the reply feature. Specifically, up votes can be registered by replying with a numeric value of 1, and down votes can be registered by replying with a numeric value of -1.

Hypothesis Explorer automatically looks for any child posts that contain 1s or -1s, counts the total vote for each parent comment, and then displays the count in a column variable called “votes”.