Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions R/ds.acmPlot.R
Original file line number Diff line number Diff line change
@@ -1,26 +1,19 @@
#' @title Client-side function to generate hazard ratio plots in DataSHIELD
#' @description This function creates a ggplot visualization for hazard ratio analysis
#' by getting the prediction data from the server-side acmPlotDS function.
#'
#' @details This function takes a prediction object created by ds.Predict and generates
#' a customizable ggplot visualization. The function allows customization of colors,
#' line sizes, axis labels, and more.
#'
#'
#'
#' @description Builds a ggplot hazard ratio curve per study using prediction data retrieved from a server-side prediction object.
#' @details This function calls the server-side aggregate function to retrieve summarized prediction data for a named server-side object, then builds one ggplot2 plot per study locally in R using ggplot2::ggplot, geom_line, geom_hline, and related layers. It also relies on the rms package being available locally for plotting support. Server function called: `acmPlotDS`.
#' @param pred_obj character string specifying the name of prediction object on the server-side
#' created using ds.Predict()
#' @param outcome_name character string specifying the outcome name (e.g., "ACM", "CVD") (default: "ACM")
#' @param line_color color for the main line (default: "blue")
#' @param line_size size of the main line (default: 2)
#' @param ref_line_color color for the reference line (default: "brown")
#' @param ref_line_size size of the reference line (default: 1.5)
#' @param x_breaks numeric vector for x-axis breaks (optional)
#' @param x_breaks Optional numeric vector of x-axis tick positions; if NULL, breaks are computed automatically as five evenly spaced values across the observed x range for each study.
#' @param x_label label for x-axis (default: "Primary exposure")
#' @param y_label label for y-axis (default: "Hazard ratio")
#' @param event_n number of events (optional)
#' @param datasources a list of \code{\link{DSConnection-class}} objects obtained after login
#' @return a list of ggplot objects from each study
#' @return Returns a plain R list of ggplot objects, one per study/data source, built from the aggregated prediction data; no additional disclosure control is applied within this function since only already-aggregated summary data is used for plotting.
#' @author Xavier Escribà Montagut, 2025
#' @examples
#' \dontrun{
Expand Down
Loading