---
params:
study: 'CDISCPILOT01'
data: 'ADSL'
data_name: 'ADSL'
by: NULL
title: 'Study: `r params$study` Data: `r params$data_name`'
date: " Created: `r format(Sys.time(),format='%A %d %b %Y %I:%M %p %Z')`"
output:
flexdashboard::flex_dashboard:
self_contained: true
mathjax: NULL
source_code: embed
---
```{=html}
```
```{r knitr-defaults}
knitr::opts_chunk$set(warning = FALSE, message = FALSE, comment = NA)
knitr::opts_chunk$set(cache = FALSE)
options(width=170)
```
```{r load-packages}
library(dataxray)
library(tidyverse)
library(haven)
library(crosstalk)
```
```{r sample-vars, include=FALSE}
data <- read_xpt("https://raw.githubusercontent.com/phuse-org/phuse-scripts/master/data/adam/cdiscpilot01/adsl.xpt") %>%
select(SUBJID, SITEID, ARM, AGE, SEX, RACE, ETHNIC,
TRT01A, SAFFL, VISIT1DT, TRTSDT, TRTEDT,
MMSETOT, BMIBL, HEIGHTBL, WEIGHTBL , DSRAEFL, DTHFL)
dim <- dim(data)
data_xray <- make_xray(data, by = params$by)
```
# DATA XRAY {#main}
Inputs {.sidebar data-width=300}
-------------------------------------
```{r}
d_reactable <- data_xray
d_reactable_shared <- SharedData$new(d_reactable)
filter_select('type', 'variable TYPE', d_reactable_shared, ~ TYPE)
filter_select('var', 'variable NAME', d_reactable_shared, ~ VAR)
filter_select('lab', 'variable LABEL', d_reactable_shared, ~ LABEL)
filter_select('n', 'variable COMPLETE',d_reactable_shared, ~ ifelse(n == dim[1], 'YES', 'NO'))
filter_slider('missing', 'variable % MISSING', d_reactable_shared, ~ 100*(missing/dim[1]),
width = 250,
post = '%',
min = 0, max = 100,
dragRange = FALSE,
step = 5, round = TRUE, sep = '', ticks = TRUE)
filter_slider('distinct', 'variable # DISTINCT', d_reactable_shared, ~ distinct,
width = 250,
min = 1, dragRange = FALSE,
step = 5, ticks = FALSE)
```
Column
-------------------------------------
### **`r toupper(params$data_name)`** DATA with **`r dim[1]`** OBSERVATIONS and **`r dim[2]`** VARIABLES
```{r create-reactable-1}
view_xray(data_xray = d_reactable, data_xray_shared = d_reactable_shared, by = params$by)
```