To use a RStudio Connect board, you need to first authenticate. The easiest way to do so is by launching Tools - Global Options - Publishing

  • Connect, and follow the instructions.

If you use multiple RStudio connect servers or multiple user accounts, you'll need to specify the server or account parameters when connecting to the board.

board_rsconnect(
  server = NULL,
  account = NULL,
  key = NULL,
  output_files = FALSE,
  cache = board_cache_path(name),
  name = "rsconnect",
  ...
)

Arguments

server

Optional address to RStudio Connect server.

account

Optional account name to use with RStudio Connect.

key

The RStudio Connect API key.

output_files

Should the output in an automated report create output files

cache

Cache path. Every board requires a local cache to avoid downloading files multiple times. The default stores in a standard cache location for your operating system, but you can override if needed.

name

An optional name used identify the board. This is no longer generally needed since you should be passing around an explicit board object.

...

Additional parameters required to initialize a particular board.

Sharing

You can share pins with others in RStudio Connect by changing the viewers of the document to specific users or groups. This is accomplished by opening the new published pin and then changing access under the settings tab. After you've shared the pin, it will be automatically available to others.

Public

You can also choose to share a pin publicly and avoid having to register the RStudio Connect board to retrieve this pin.

To create a public pin, first publish a pin and navigate to RStudio Connect; then set the "Access" to "Anyone - no login required" -- The pin will become public and accessible to anyone using their content URL. The remote resource stored in RStudio Connect can then be cached locally with pin() as follows:

pin("https://rstudio-connect-server/content/1234", name = "my-rsc-content")

To avoid having to change the "Access" manually, you can also set the access_type to acl, loggend_in or all when creating a pin:

 pin("https://rstudio-connect-server/content/1234", name = "my-rsc-content",
   access_type = "all"
 )

Automation

One significant advantage of RStudio Connect over other boards is its ability to schedule R Markdown reports to automate the creation of pins.

To support automation you need to use an RStudio Connect API Key as your authentication method. Once you've got an API key, you can connect to the board with:

board <- board_rsconnect(
  server = "https://rstudio-connect-server",
  key = Sys.getenv("CONNECT_API_KEY"),
)

Note the use of an environment variable to ensure that the API key is not stored in plain text in the document.

See also

Examples

if (FALSE) { # the following examples require an RStudio Connect API key # register from rstudio board <- board_rsconnect() # register from rstudio with multiple servers board <- board_rsconnect(server = "https://rstudio-connect-server") # register from rstudio with multiple account board <- board_rsconnect(account = "account-name") # register automated report for rstudio connect board <- board_rsconnect( key = Sys.getenv("CONNECT_API_KEY"), server = Sys.getenv("CONNECT_SERVER") ) }