Skip to content

How to Publish an R Markdown Document to RStudio Connect#

This guide used RStudio IDE Version 1.3.959.

This guide walks you through creating a new R Markdown document and then publishing your document to RStudio Connect.

Prerequisites#

Before you begin, you must:

For more information about requesting permission to publish your content, please see the Publishing section of the User Guide.

Note

As you walk through this guide, there may be additional steps that are required due to your unique environment. For example, you may need to install or update packages, restart R, etc. In many cases, RStudio prompts you to complete the action that is required to continue with this guide. If you get stuck, please refer to the Related Documentation section or the RStudio Connect Admin Guide.

Step 1. Create a new R Markdown Document#

RStudio IDE has a sample R Markdown document that is available out of the box. For this guide, we are going to utilize the sample HTML R Markdown document because everyone has access to it, and it allows us to focus on the task of publishing an R Markdown document to RStudio Connect instead of manually creating the document from scratch. Let's begin!

  • Open the RStudio IDE.
  • From the menu bar, select File > New File > R Markdown.... Screen capture of the RStudio IDE New File options

   The New R Markdown window displays.

  • Do the following:
  1. Give your document a title.
  2. Optional - Give your document an author.
  3. Since we are creating an R Markdown document using HTML as the output format, no action is required.
  4. Click OK.

Screen capture of the New R Markdown configuration window

   The new R Markdown document displays in the editor.

Note

For this How To, we are creating an R Markdown document using the Output Format option, "HTML". However, there are other default options:

  • PDF
  • Word

Now, we need to Knit the file which generates the document that includes the content as well as the output of any embedded R code chunks included in the document. Essentially, this step ensures that your document was successfully created and works as intended.

  • At the top of the editor, click Knit. Knit button

   The Save File window displays.

  • In the File name field, type a name for the document.

    Info

    The Save File window that displays may vary based on your OS or version of RStudio IDE.

  • Optionally, you can create a new folder or select an existing folder.

  • Click Save. Save button

   If the Knit was successful, then your document automatically opens in a new browser tab. If it doesn't automatically display, your app may have been blocked as a popup in your browser.

Example of the R Markdown document displaying in
  a browser tab

Step 2. Publish your R Markdown document to RStudio Connect#

Note

Before you execute this step, verify that you have connected your RStudio Account. The procedures are available here.

  • At the top of the editor, click Publish. Screen capture of Publish button
  • In the Publish to Server window, confirm that your account is shown in the Publish To Account section and click Publish. Publish to Server window with
      user account selected

    User Tips

    • You can monitor the status of the deployment in the RStudio IDE Deploy pane.
    • If for any reason you would like to stop the deployment, you can simply click the Stop button located in the Deploy pane.
    • Your newly deployed R Markdown document automatically opens in a new browser tab if the Launch browser check box is selected (it is selected by default).
    • If it doesn't automatically display, your app may have been blocked as a popup in your browser.

Step 3. View your R Markdown Document on RStudio Connect#

  • Navigate back to the RStudio Connect server that you published your content to.
  • If applicable, log back into RStudio Connect.
  • To view the Content that you own, click the Show Options panel button. Screen capture of the Show options button selected
  • In the Owners section, select Yours. Screen capture of Options window with the Yours
  radio button selected    Your R Markdown document should display in the Content section.

  • To view your R Markdown document, simply click the title of your app. Screen capture of content being selected

       Your R Markdown displays in the RStudio Connect browser window.

    Screen capture of the published R Markdown document