-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpins.qmd
50 lines (39 loc) · 927 Bytes
/
pins.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
---
title: "Gecko hospital-level data to pins"
author: "Neil Clark"
format: html
editor: source
---
# Pull data
```{r}
library(tidyverse)
library(pins)
library(finalfit)
source("01_pull.R")
source("02_join_world_bank.R")
source("03_checkbox_variable_handling.R")
source("04_cleaning.R")
source("05_join_patient_data.R")
```
# Make NAs explicit
```{r}
#hospital_data_orig = hospital_data_orig %>%
# mutate(across(where(is.factor), ~fct_na_value_to_level(., "Missing")))
```
# Write pin
```{r}
board = board_connect()
board %>% pin_write(hospital_data_orig, "nclark/hospital_data", type = "rds")
```
# Usage
```{r, eval = FALSE}
library(pins)
board = board_connect()
hospital_data = pin_read(board, "nclark/hospital_data")
date_updated = pin_meta(board, "nclark/hospital_data")$created
```
## write pin for join
```{r}
board = board_connect()
board %>% pin_write(joined_data, "nclark/joined_data", type = "rds")
```