-
Notifications
You must be signed in to change notification settings - Fork 0
/
Creating_pins_on_Connect.qmd
34 lines (25 loc) · 1.61 KB
/
Creating_pins_on_Connect.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
---
title: "Creating Pins on Connect"
author: "Trishang Udhwani"
format:
html:
toc: true
toc-location: left
toc-depth: 2
number-sections: true
number-depth: 3
editor: visual
---
## Overview
Pins lets you pin an R or Python object, or a file to a virtual board where you and others access it.
The process is described in the official documentation at: [Pins](https://docs.posit.co/connect/how-to/pins/). Please refer to that link for details.
Every pin lives on a board, so your first step is to create a board object which can be called. This can be done using the function `board <- pins::board_connect()`.\
Note that no arguments are passed to `board_connect()`. This function is designed to just work for most cases.
::: callout-note
If you are using an out-dated version of Rstudio (versions before 2024.04.1) then this function may not work.\
In that case can specify the `auth` method to inform how you authenticate to Connect. This can be done by using `auth = "envvar"` as the argument.
To do this, set environment variables with `usethis::edit_r_profile()` to open your `.Renviron` for editing, and then insert `Sys.setenv(CONNECT_API_KEY="paste key value")` and `Sys.setenv(CONNECT_SERVER="https://connect.posit.vetinst.no/")`. Remember to insert a newline character (press ENTER) before saving this file.
Now you can create the board object using `board <- pins::board_connect(auth = "envvar")`
:::
## Additional things to consider
Remember, if you’re using git, it’s a good idea to add your `.Renviron` to your `.gitignore` to ensure you’re not publishing your API key to your version control system.