Example Import

You need to provide the function with the location (path and filename) of the Excel file, the name of the sheet containing the data and the name of the sheet containing the dictionary.

library(importExcel)
data_file <- system.file("extdata", "study_data.xlsx", package = "importExcel")

# This will read in the file, add variable labels and recode variables to 
# factors as specified in the dictionary sheet
file_import <- read_excel_with_dictionary(data_file = data_file,
                                          data_sheet = "data",dictionary_sheet = "dict")

# extract the recoded-data
coded_data <- file_import$coded_data

file_import contains the following objects:
# check warnings
file_import$warnings

# check for text omitted from numeric data
file_import$numeric_converstions

# check for attempted date conversions
file_import$date_converstions

# Look at the dictionary used
file_import$updated_dictionary

Describe the coded data:

require(tidyverse)
require(reportRmd)

coded_data |> 
  select(!studyID) |> 
  rm_compactsum(xvars=everything())
## no statistical tests will be applied to date variables, date variables will be summarised with median
Full Sample (n=100)
Age at diagnosis 44.0 (32.0-57.2)
sex - Male 45 (45%)
BMI 29.0 (23.4-34.2)
heart rate (bmp) 84.0 (72.0-92.0)
date of diagnosis 2021-11-12 (2020-11-18 to 2023-06-18)
date of randomisation 2023-06-25 (2023-04-18 to 2023-08-30)
ECOG 1.0 (0.0-3.0)
Treatment 47 (47%)
baseline score 61.5 (27.5-76.2)
final score 42.5 (18.5-81.5)
hospital
PMH 35 (35%)
Western 33 (33%)
Krembil 32 (32%)
Diagnosis
lupus 24 (24%)
mumps 24 (24%)
measles 31 (31%)
rubella 21 (21%)