Tendril {Tendril} | R Documentation |
Tendril
Description
Function to calculate coordinates and statistical measures used to create a tendril plot
Usage
Tendril(mydata, rotations, AEfreqThreshold = 50, Tag = "Comment",
Treatments = c("Active", "Placebo"),
Unique.Subject.Identifier = "Unique.Subject.Identifier",
Terms = "Dictionary.Derived.Term", Treat = "Actual.Treatment...DB",
StartDay = "Analysis.Start.Relative.Day", SubjList = NULL,
SubjList.subject = NULL, SubjList.treatment = NULL,
SubjList.dropoutday = NULL, compensate_imbalance_groups = FALSE,
filter_double_events = FALSE, suppress_warnings = FALSE)
Arguments
mydata |
A dataframe containing the data for the tendril calculations |
rotations |
a vector of same length as mydata containing the rotation factors for all the events |
AEfreqThreshold |
The minimum frequency threshold of events to be included in the analysis. Default is 50 |
Tag |
A tag or comment associated with the analysis |
Treatments |
The names of the two treatments to be included in the tendril. The first treatment bends to the right and second treatment bends to the left. Must be a vector of two elements and the two elements must be found in the Treatment column |
Unique.Subject.Identifier |
The name of the column containing the unique patients IDs |
Terms |
The name of the column containing the name of the tendrils (e.g. adverse event terms) |
Treat |
The name of the column containing the name of the treatments |
StartDay |
The name column containing the days of the events |
SubjList |
A dataframe containing subject IDs and treatments |
SubjList.subject |
The name of the columns in SubjList containing the subjects IDs |
SubjList.treatment |
The name of the columns in SubjList containing the treatments |
SubjList.dropoutday |
The name of the column in SubjList containing the dropoutday |
compensate_imbalance_groups |
Boolean Whether the rotation factors have been compensated for imbalance in the groups |
filter_double_events |
Boolean whether to filter out events duplicated in subject id and adverse effect |
suppress_warnings |
Boolean whether to suppress warnings from chi squared approximation may be incorrect |
Details
The function accepts a dataframe with at least 4 columns named as the arguments Unique.Subject.Identifier, Terms, Treat and StartDay.
Two treatments must be given as arguments, and at least one of the two treatments must be found in the Treatment column
The function returns an object of class tendril. The object contains the coordinates for the tendril plot and the arguments of the tendril function
The result of the function can be plotted with plot()
The result can be saved to file using write.table() with argument row.names = FALSE
Value
The function return an object of class tendril. The object contains the original dataset added with the tendril coordinates, all the function arguments and a dataframe with the results from statistical analysis
data$data : Dataframe of orginal data, coordinates and stat results
data$Unique.Subject.Identifier : Column containing subject IDs
data$Terms : Column containing the name of the tendrils
data$Treat : Column containing the name of the treatments
data$StartDay : Column containing the days of the events
data$Treatments : The names of the treatments causing the tendrils to bend
data$AEfreqThreshold : The frequency threshold for the events to be included in the analysis
data$Tag : A tag or comment associated with the analysis
data$n.tot : A dataframe with the total number of events for each treatment. Used in the statistical calculations
data$SubjList : A dataframe containing subject IDs and treatments
data$SubjList.subject : The name of the columns in SubjList containing the subjects IDs
data$SubjList.treatment : The name of the columns in SubjList containing the treatments
data$SubjList.dropoutday : The name of the column in SubjList containing the dropoutday
data$rotation_vector : Rotation vector used to generate the tendril
data$compensate_imbalance_groups : Boolean Whether the rotation factors have been compensated for imbalance in the groups
Examples
data <- Tendril(mydata = TendrilData,
rotations = Rotations,
AEfreqThreshold=9,
Tag = "Comment",
Treatments = c("placebo", "active"),
Unique.Subject.Identifier = "subjid",
Terms = "ae",
Treat = "treatment",
StartDay = "day",
SubjList = SubjList,
SubjList.subject = "subjid",
SubjList.treatment = "treatment"
)
plot(data)