Type: | Package |
Title: | A 'shiny' Application for the (Audio-)Visualization of Adverse Event Profiles |
Version: | 4.2.7 |
Description: | Contains a 'shiny' application called AdEPro (Animation of Adverse Event Profiles) which (audio-)visualizes adverse events occurring in clinical trials. As this data is usually considered sensitive, this tool is provided as a stand-alone application that can be launched from any local machine on which the data is stored. |
Depends: | R (≥ 3.5.0), shinyBS, seriation (≥ 1.2.9) |
License: | GPL-3 |
URL: | https://github.com/Bayer-Group/BIC-AdEPro |
Encoding: | UTF-8 |
RoxygenNote: | 7.2.3 |
Imports: | graphics, MASS, V8, forcats, here, utils, shinyjs, shiny, audio, shape, Cairo, dplyr, readr, rlang, tidyr, haven, stats, shinyWidgets, DT |
Suggests: | knitr, rmarkdown, testthat |
VignetteBuilder: | knitr |
NeedsCompilation: | no |
Packaged: | 2025-03-24 20:14:20 UTC; sgfpj |
Author: | Nicole Rethemeier [cre], Christoph Tasto [aut], Steffen Jeske [aut], Bodo Kirsch [aut] |
Maintainer: | Nicole Rethemeier <nicole.rethemeier@bayer.com> |
Repository: | CRAN |
Date/Publication: | 2025-03-25 09:30:11 UTC |
Adverse event data set included in AdEPro
Description
Adverse event data set included in AdEPro
adeproLogo Function that creates a div container for the AdEPro Logo
Description
creates a div container with AdEPro Logo for the shiny app adepro
Usage
adeproLogo(height = 230, width = 160, align = "right")
Arguments
height |
height of the Logo (numeric) |
width |
width of the Logo (numeric) |
align |
Alignment of the Logo ("center"/"left"/"right) |
adepro_slice_plot - function to create pie chart graph
Description
Create pie chart graph for app adepro
Usage
adepro_slice_plot(
data,
patients,
ae_list,
global_params,
height,
width,
xlines,
ylines,
xval,
title,
subgroup,
slider,
subjidn,
adepro_colors = c("#e43157", "#377eb8", "#4daf4a", "#984ea3", "#ff7f00", "#ffff33",
"#a65628", "#f781bf", "#21d4de", "#91d95b", "#b8805f", "#cbbeeb"),
info = NULL,
legend_ae = NULL,
arrow_data = NULL,
show_arrows = FALSE
)
Arguments
data |
adverse event data set |
patients |
patient data set |
ae_list |
list with selected adverse events |
global_params |
global parameter |
height |
height size |
width |
width size |
xlines |
lines position x |
ylines |
lines position y |
xval |
label x-axis |
title |
graph title |
subgroup |
selected subgroup |
slider |
day |
subjidn |
subjidn variable |
adepro_colors |
colors used in adepro (max 12) |
arrow_data |
data.frame with information which start/end date are imputed |
show_arrows |
logical value if arrows should be displayed for imputed data |
Subject level data set included in AdEPro
Description
Subject level data set included in AdEPro
ae_count - provides adverse event count dataset
Description
Provides data set with one adverse event by day and by treatment groups with variable 'freq', giving a categorization (integer between 0 and 4) of the frequency of the adverse event on a specific day by treatment group.
Usage
ae_count(ae_data, patient)
Arguments
ae_data |
adverse event dataset |
patient |
patient dataset |
bar_chart - creates barchart of AEs for all patient
Description
Creates bar charts daily and total for all patients separately according to treatment (R Package required: 'dplyr')
Usage
bar_chart(
ae_data = ae,
patients = patient,
day = day_slider,
variables = vars,
day_max = day_mx,
count_max = count_mx,
treatments = treatments,
cex.n = 2
)
Arguments
ae_data |
Adverse event dataset |
patients |
Patient dataset |
day |
The study day of interest |
variables |
Vector of Adverse events |
day_max |
Maximum Day |
count_max |
Maximum Counts |
cex.n |
Font size of the text in the bars |
check_data - Consistency checks on the data
Description
Runs consistency checks on the adverse event and patient data
Usage
check_data(ae_data, patients)
Arguments
ae_data |
adverse event dataset |
patients |
patient dataset |
circle_legend - Function to create legend for displayed subjects
Description
Creates legend object for base R plots
Usage
circle_legend()
circle_legend2 - Creates Legend for Subject elements in AdEPro (version 2)
Description
Drawing legends for symbols in app
Usage
circle_legend2(
aes,
colors = c("#e43157", "#377eb8", "#4daf4a", "#984ea3", "#ff7f00", "#ffff33", "#a65628",
"#f781bf", "#21d4de", "#91d95b", "#b8805f", "#cbbeeb")
)
Arguments
aes |
list of selected adverse events |
colors |
color vector for adverse events |
count_event Count the event number for every AE at specified timepoint
Description
Count the event number for every AE at specified timepoint
Usage
count_event(total = tot, day = 1)
Arguments
total |
data set with ae data and patient data merged |
day |
The study day of interest |
initQ - generates classification matrix
Description
Creates the classification matrix of adverse events such as treatment-emergent
Usage
initQ(ae_data)
Arguments
ae_data |
adverse event dataset |
launch_adepro - Launches the AdEPro application
Description
Starts the AdEPro application in the client's browser.
Usage
launch_adepro(host = "127.0.0.1", port = NULL, browser = NULL)
Arguments
host |
host link (defaults to the local machine "127.0.0.1") |
port |
port number (randomly chosen unless specified as a certain number) |
browser |
path to browser exe (defaults to standard browser) |
Details
Further information on how to use this application can be found in the vignette of this package.
Value
A shiny app
Examples
## Not run:
## Launch application on localhost (127.0.0.1)
## -------------------------------------------
## By default launch_adepro starts the application on localhost
## and a randomly selected port (e.g. 9876), in which case you can connect
## to the running application by navigating your browser to
## http://localhost:9876.
launch_adepro()
## Launch application on a different host
## --------------------------------------
## You can also run the application on a different host
## by specifying a hostname and port. Just make sure to
## use an open port on your machine. Here "open" means
## that the port should not be used by another service
## and the port is opened by your firewall.
launch_adepro(host="your-hostname", port=8888)
## Make the application available to your coworkers
## ------------------------------------------------
## within your local area network even without a
## dedicated Shiny server. The value set through the
## host argument says to accept any connection (not just from localhost).
## Then take note of your local IP (if you are under linux,
## you can see it through ifconfig). Say your IP is 192.168.1.70.
## Your colleagues can use your app by inserting in the address
## bar of their browser 192.168.1.70:8888, i.e. your IP followed
## by : and the port number you selected.
launch_adepro(host="0.0.0.0", port=8888)
## Launch application on a different browser
## ----------------------------------------
## To run the shiny app on a different browser than your standard browser
## use the "browser" argument to set the path to the respective .exe file.
launch_adepro(browser = "C:/Program Files/Mozilla Firefox/firefox.exe")
## launching the application.
## End(Not run)
Draw Symbols (User Defined) on a Plot
Description
This function draws symbols on a plot. It is similar to the builtin symbols function with the difference that it plots symbols defined by the user rather than a prespecified set of symbols.
Usage
my.symbols(x, y=NULL, symb, inches=1, xsize, ysize,
add=TRUE,
vadj=0.5, hadj=0.5,
symb.plots=FALSE,
xlab=deparse(substitute(x)),
ylab=deparse(substitute(y)), main=NULL,
xlim=NULL, ylim=NULL, linesfun=lines,
..., MoreArgs)
Arguments
x , y |
The x and y coordinates for the position of the symbols to be plotted. These can be specified in any way which is accepted by xy.coords. |
symb |
Either a matrix, list, or function defining the symbol to be plotted. If it is a matrix or list it needs to be formatted that it can be passed directly to the lines function. It then defines the shape of the symbol on on a range/domain of -1 to 1. If this is a function it can either return a matrix or list as above (points on the range/domain of -1 to 1), or it can do the plotting itself. |
inches |
The size of the square containing the symbol in inches (note: unlike symbols this cannot be FALSE). This is ignored if xsize or ysize is specified. |
xsize |
The width of the bounding box(s) of the symbols in the same units as the x variable. Computed from ysize or inches if not specified. Can be a single value or a vector. |
ysize |
The height of the bounding box(s) of the symbols in the same units as the y variable. Computed from xsize or inches if not specified. Can be a single value or a vector. |
add |
if 'add' is 'TRUE' then the symbols are added to the existing plot, otherwise a new plot is created. |
vadj , hadj |
Numbers between 0 and 1 indicating how 'x' and 'y' specify the location of the symbol. The defaults center the symbol at x,y; 0 means put the bottom/left at x,y; and 1 means put the top/right of the symbol at x,y. |
symb.plots |
If symb is a function that does its own plotting, set this to TRUE, otherwise it should be FALSE. |
xlab , ylab , main , xlim , ylim |
If 'add' is 'FALSE' these are passed to the plot function when setting up the plot. |
linesfun |
The function to draw the lines if the function does not do its own drawing. The default is lines but could be replaced with polygon to draw filled polygons |
... |
Additional arguments will be replicated to the same length as x then passed to symb (if symb is a function) and/or the lines function (one value per symbol drawn). |
MoreArgs |
A list with any additional arguments to be passed to the symb function (as is, without being replicated/split). |
Details
The symb argument can be a 2 column matrix or a list with components 'x' and 'y' that defines points on the interval [-1,1] that will be connected with lines to draw the symbol. If you want a closed polygon then be sure to replicate the 1st point as the last point. If any point contains an NA then the line will not be drawn to or from that point. This can be used to create a symbol with disjoint parts that should not be connected. If symb is a function then it should include a '...' argument along with any arguments to define the symbol. Any unmatched arguments that end up in the '...' argument will be replicated to the same length as 'x' (using the rep function) then the values will be passed one at a time to the symb function. If MoreArgs is specified, the elements of it will also be passed to symb without modification. The symb function can either return a matrix or list with the points that will then be passed to the lines function (see above). Or the function can call the plotting functions itself (set symb.plots to TRUE). High level plotting can be done (plot, hist, and other functions), or low level plotting functions (lines, points, etc) can be used; in this case they should add things to a plot with 'x' and 'y' limits of -1 to 1. The size of the symbols can be specified by using inches in which case the symbol will be set inside of squares whose sizes are inches size based on the plotting device. The size can also be set using xsize and/or ysize which use the same units as the x and/or y variables. If only one is specified then the box will be square. If both are specified and they do not match the aspect ratio of the plot then the bounding box will not be square and the symbol will be distorted.
Value
This function is run for its side effect of plotting, it returns an invisible NULL.
Note
Since the '...' argument is passed to both lines and symb, the symb function should have a '...' argument so that it will ignore any additional arguments. Arguments such as 'type' can be passed through the '...' argument if you want the symbol made of something other than lines. Plotting coordinates and sizes are based on the size of the device at the time the function is called. If you resize the device after plotting, all bets are off. Currently missing values in x or y are not handled well. It is best if remove all missing values first.
Author(s)
Greg Snow
order_patient - Arranges patients by sequencing technique
Description
Arranges patients by sequencing technique (R Package required: 'dplyr', 'reshape2, 'seriation')
Usage
order_patient(
ae_data = ae_data,
patients = patient_d,
variables = input$varSeq,
method_dist = "euclidean",
method_seriate = input$methSeq
)
Arguments
ae_data |
Adverse event dataset |
patients |
Patient dataset |
variables |
Vector with Variable Names used to seriate |
method_dist |
Character string with the name of the method to calculate the distance matrix |
method_seriate |
Character string with the name of the method to seriate |
pie_legend - Function to create legend for displayed adverse events
Description
Creates legend object for base R plots
Usage
pie_legend(
aes,
colors = c("#e43157", "#377eb8", "#4daf4a", "#984ea3", "#ff7f00", "#ffff33", "#a65628",
"#f781bf", "#21d4de", "#91d95b", "#b8805f", "#cbbeeb")
)
Arguments
aes |
chosen adverse events to display (character) |
colors |
Colors for slices (this should be maximally 8) (character) |
pie_legend2 - Creates Legend for adverse events slices in AdEPro (version 2)
Description
Drawing legends for adverse event symbols in app
Usage
pie_legend2(
tmp,
aes,
colors = c("#e43157", "#377eb8", "#4daf4a", "#984ea3", "#ff7f00", "#ffff33", "#a65628",
"#f781bf", "#21d4de", "#91d95b", "#b8805f", "#cbbeeb"),
legend_click = NULL,
info
)
Arguments
aes |
list of selected adverse events |
colors |
color vector for adverse events |
prepare_data - read SAS or CSV raw data and prepare the data sets
Description
Creates a list with two data sets 'pat_data' and 'ae_data' in format which is used in the AdEPro Application
Usage
prepare_data(
dat,
SUBJIDN = "SUBJIDN",
TRT01A = "TRT01A",
SAFFN = "SAFFN",
LVDT = "LVDT",
DTHDT = "DTHDT",
TRTSDT = "TRTSDT",
AEDECOD = "AEDECOD",
AESTDY = "AESTDY",
AETRTEMN = "AETRTEMN",
AEENDY = "AEENDY",
AESEVN = "AESEVN",
AESERN = "AESERN",
AERELN = "AERELN",
AERELPRN = "AERELPRN",
AEACNN = "AEACNN",
optional_vars = NULL,
adsl_data = NULL
)
Arguments
dat |
adae data set. |
SUBJIDN |
Subject Id as numeric (required) |
TRT01A |
Treatment Group as character (required) |
SAFFN |
Safety Flag as numeric (required) |
LVDT |
Last Visit Date as numeric (required) |
DTHDT |
Death Date as numeric (required) |
TRTSDT |
Treatment Start Date as numeric (required) |
AEDECOD |
Adverse Event Code as character (required) |
AESTDY |
Adverse Event Start Date as numeric (required) |
AETRTEMN |
Adverse Event Treatment Emergency Flag as numeric (required) |
AEENDY |
Adverse Event End date as numeric (required) |
AESEVN |
Adverse Event Severity Grade Flag as numeric (required) |
AESERN |
Adverse Event Serious Flag as numeric (optional) |
AERELN |
Adverse Event Related Flag as numeric (optional) |
AERELPRN |
Adverse Event Flag as numeric (optional) |
AEACNN |
Adverse Event Flag as numeric (optional) |
optional_vars |
List optional Variables for the patient data set. |
adsl_data |
Subject Level data set (optional) |
preproc_ae - Preprocessing adverse event data
Description
Preprocesses adverse event dataset
Usage
preproc_ae(ae_data)
Arguments
ae_data |
adverse event dataset |
preproc_patients - Preprocessing Patient Data
Description
Preprocesses patient dataset
Usage
preproc_patients(patients, height)
Arguments
patients |
patient dataset |
height |
number of circles to be displayed on the vertical axis |
Server part of the AdEPro application
Description
Server part of the AdEPro application
Usage
server(input, output, session)
Value
No return value. Server part of the app, used in launch_adepro-function.
set_global_params - sets all global parameters
Description
Function that sets all global parameters
Usage
set_global_params(
ae_data,
patients,
title = NULL,
height = NULL,
treatment = NULL
)
Arguments
ae_data |
adverse event dataset |
patients |
patient dataset |
title |
titles for the treatment groups |
height |
number of circles on the vertical axis |
set_group_lines - determines coordinates for the separating lines
Description
Calculates coordinates for separating lines between the treatment groups
Usage
set_group_lines(patients, height, treatment)
Arguments
patients |
patient dataset |
height |
number of circles on the vertical axis |
set_vector_layout - creates vector layout
Description
creates vector layout for circles considering number of rows and treatment groups
Usage
set_vector_layout(patients, height)
Arguments
patients |
patient dataset |
height |
number of circles on the vertical axis |
set_width - calculates width (number of columns with circles)
Description
Calculates vector with 1's with its length as the number of circles on the vertical axis
Usage
set_width(patients, height)
Arguments
patients |
patient dataset |
height |
number of circles on the vertical axis |
tone - Function that plays two different sounds for adverse events
Description
Plays two different sounds (after one another) for treatment group comparison for a specific adverse event
Usage
tone(no1 = 0, no2 = 0, d = 0.7)
Arguments
no1 |
classification of the frequency of the AE in the first treatment group (0=no AE chosen, 1=no occurrence, 2=rare, 3=occasionally, 4=often) |
no2 |
classification of the frequency of the AE in the second treatment group ( 0=no AE chosen, 1=no occurrence, 2=rare, 3=occasionally, 4=often) |
d |
Duration of the sounds (numeric, in seconds) |
User Interface of the AdEPro application
Description
User Interface of the AdEPro application
Usage
ui
Format
An object of class shiny.tag.list
(inherits from list
) of length 4.
Value
No return value. User interface part of the app, used in launch_adepro-function.