pins-r icon indicating copy to clipboard operation
pins-r copied to clipboard

Update the "CODE" block in the RStudio Connect HTML preview

Open sellorm opened this issue 2 years ago • 2 comments

The code block currently suggest this piece of code:

library(pins)
board <- board_rsconnect("envvar", server = "https://connect.example.com")
pin_read(board, "username/pin_name")

This is nice, but envvar auth frequently doesn't work out of the box unless the user is already pins user and has previously configured it.

Including a note about how to set that up and well as a similar code snippet for python would be ideal.

So we'd end up with something like (though with the appropriate URLs and pin names substituted in):


Code

The following examples assume you have your Connect API key stored in a CONNECT_API_KEY environment variable. Please refer to the documentation for more information and information on other supported authentication modes.

R

library(pins)
board <- board_rsconnect("envvar", server = "https://connect.example.com")
pin_read(board, "username/pin_name")

Pins for R documentation

Python

import pins
board = pins.board_rsconnect(server_url = "https://connect.example.com")
board.pin_read("username/pin_name")

Pins for python documentation


This could perhaps be collapsible, though it should be clear even when collapsed that this section contains R and Python code.

More than anything this is about on-boarding new users to the pins ecosystem more quickly if someone within their organisation has shared a pin with them.

There is an equivalent ticket in pins-python repo.

sellorm avatar May 12 '22 09:05 sellorm

At a minimum, it would be great if the code provided today were labelled as being R code, just to avoid any potential confusion with pins published to Connect from Python using a different code snippet.

sellorm avatar Jul 08 '22 10:07 sellorm

Related to #603

juliasilge avatar Aug 16 '22 16:08 juliasilge

Looks like the Connect docs have updated the recommended approach (no more server arg included) so we should likely update what we have as well.

juliasilge avatar Oct 27 '22 22:10 juliasilge

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.

github-actions[bot] avatar Dec 31 '22 00:12 github-actions[bot]