How to Publish an R Markdown Document to Posit 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 Posit Connect, formerly RStudio Connect.
Before you begin, you must:
- Install R
- Install the RStudio Integrated Development Environment (IDE)
- Have the public URL of the Connect server
- Have a valid Connect account that has been promoted to at least the Publisher role
- Connect your Posit Account
For more information about requesting permission to publish your content, please see the Publishing section of the User Guide.
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 Connect Admin Guide.
Step 1. Create a new R Markdown Document#
The 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 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....
The New R Markdown window displays.
- Do the following:
- Give your document a title.
- Optional - Give your document an author.
- Since we are creating an R Markdown document using HTML as the output format, no action is required.
- Click OK.
The new R Markdown document displays in the editor.
For this How To, we are creating an R Markdown document using the Output Format option, "HTML". However, there are other default options:
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.
The Save File window displays.
In the File name field, type a name for the document.
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.
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.
Step 2. Publish your R Markdown document to Connect#
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.
In the Publish to Server window, confirm that your account is shown in the Publish To Account section and click Publish.
- 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 Connect#
- Navigate back to the Connect server that you published your content to.
- If applicable, log back into Connect.
- To view the Content that you own, click the Show Options panel button.
In the Owners section, select Yours. Your R Markdown document should display in the Content section.
To view your R Markdown document, simply click the title of your app.
Your R Markdown displays in the Connect browser window.