From 9db29ebaf27f985da405719562061f3b7d8ba4b8 Mon Sep 17 00:00:00 2001 From: Jeffrey Dickinson Date: Mon, 6 Nov 2023 18:34:37 +0000 Subject: [PATCH] #12 add tempdir --- adam/adpc.qmd | 6 ++++-- adam/adppk.qmd | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/adam/adpc.qmd b/adam/adpc.qmd index f752b7e..6c6a043 100644 --- a/adam/adpc.qmd +++ b/adam/adpc.qmd @@ -589,12 +589,14 @@ Using `{xportr}` we check variable type, assign variable lenght, add variable la ```{r} #| label: xportr #| warning: false +dir <- tempdir() # Change to whichever directory you want to save the dataset in + adpc_xpt <- adpc %>% xportr_type(metacore) %>% # Coerce variable type to match spec xportr_length(metacore) %>% # Assigns SAS length from a variable level metadata xportr_label(metacore) %>% # Assigns variable label from metacore specifications xportr_format(metacore) %>% # Assigns variable format from metacore specifications - xportr_df_label(metacore) # Assigns dataset label from metacore specifications - # xportr_write("adpc.xpt") # Write xpt v5 transport file + xportr_df_label(metacore) %>% # Assigns dataset label from metacore specifications + xportr_write(file.path(dir, "adpc.xpt")) # Write xpt v5 transport file ``` diff --git a/adam/adppk.qmd b/adam/adppk.qmd index 1008525..202cbb5 100644 --- a/adam/adppk.qmd +++ b/adam/adppk.qmd @@ -532,13 +532,14 @@ Using {xportr} we check variable type, assign variable lenght, add variable labe ```{r} #| label: xportr +dir <- tempdir() # Change to whichever directory you want to save the dataset in adppk_xpt <- adppk %>% xportr_type(metacore) %>% # Coerce variable type to match spec xportr_length(metacore) %>% # Assigns SAS length from a variable level metadata xportr_label(metacore) %>% # Assigns variable label from metacore specifications xportr_format(metacore) %>% # Assigns variable format from metacore specifications - xportr_df_label(metacore) # Assigns dataset label from metacore specifications - # xportr_write("adppk.xpt") # Write xpt v5 transport file + xportr_df_label(metacore) %>% # Assigns dataset label from metacore specifications + xportr_write(file.path(dir, "adppk.xpt")) # Write xpt v5 transport file ```