Group and Annotate Treatment Effect Estimates
group_tab.Rd
This function arranges and annotates a data frame based on specified types of treatment effect estimates (RR or RD). It supports different sorting options including default descending, alphabetical, and custom order.
Arguments
- df
Data frame containing the variables of interest.
- type
Type of treatment effect to analyze. Expected values are 'RR' for Risk Ratio and 'RD' for Risk Difference. Defaults to 'RR'.
- order
Specifies the order in which the outcomes should be arranged. Can be 'default' for descending order of the estimate, 'alphabetical' for alphabetical order by outcome, or 'custom' for a user-defined order. Default is 'default'.
- custom_order
A vector of custom ordering for the outcomes, applicable if `order` is set to 'custom'. This should be a vector containing all outcomes in the desired order.
Value
A data frame that has been arranged based on the specified order and annotated with treatment effect estimates, estimate labels, and evidence value annotations.
Examples
# Example using Risk Ratio (RR) and default sorting
result_df <- group_tab(df = analysis_df, type = 'RR')
#> Loading required package: dplyr
#>
#> Attaching package: ‘dplyr’
#> The following objects are masked from ‘package:stats’:
#>
#> filter, lag
#> The following objects are masked from ‘package:base’:
#>
#> intersect, setdiff, setequal, union
#> Error in eval(expr, envir, enclos): object 'analysis_df' not found
# Example using Risk Difference (RD) with alphabetical sorting
result_df <- group_tab(df = analysis_df, type = 'RD', order = 'alphabetical')
#> Error in eval(expr, envir, enclos): object 'analysis_df' not found
# Example using custom sorting order
custom_order <- c("Outcome3", "Outcome1", "Outcome2")
result_df <- group_tab(df = analysis_df, type = 'RR', order = 'custom', custom_order = custom_order)
#> Error in eval(expr, envir, enclos): object 'analysis_df' not found