pins-r
pins-r copied to clipboard
Update the "CODE" block in the RStudio Connect HTML preview
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")
Python
import pins
board = pins.board_rsconnect(server_url = "https://connect.example.com")
board.pin_read("username/pin_name")
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.
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.
Related to #603
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.
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.