From 0c9b9832b4e590624daa15dfa97688fd51cb78d8 Mon Sep 17 00:00:00 2001 From: Nuno Agostinho Date: Sat, 3 Feb 2024 11:09:49 +0000 Subject: [PATCH 1/5] Fix GTEx URLs --- R/data_gtex.R | 67 ++++++++++++++++++++++++--------------------------- 1 file changed, 31 insertions(+), 36 deletions(-) diff --git a/R/data_gtex.R b/R/data_gtex.R index 3f57e483..f34ca15d 100644 --- a/R/data_gtex.R +++ b/R/data_gtex.R @@ -182,47 +182,43 @@ downloadGtexFiles <- function(link, folder) { #' @keywords internal getGtexDataURL <- function(release, domain="https://storage.googleapis.com", offline=FALSE) { - path <- paste0("gtex_analysis_v", release) - resp <- try(GET(domain, path=path, timeout(3))) + path <- "adult-gtex" date <- NULL - if (!is(resp, "try-error") && !http_error(resp) && !offline) { - doc <- xmlParse(resp) - df <- xmlToDataFrame(doc, nodes=xmlRoot(doc)[-c(seq(4))], - stringsAsFactors=FALSE) - files <- c("annotations/.*Annotations_SampleAttributesDS\\.txt", - "annotations/.*Annotations_SubjectPhenotypes.*DS\\.txt", - "rna_seq_data/GTEx.*_gene_reads\\.gct\\.gz", - "rna_seq_data/GTEx.*junction.*\\.gz") - index <- unlist(sapply(files, grep, df[[1]])) - if (length(Filter(length, index)) == 0) return(NULL) - res <- df[index, "Key"] - date <- max(as.Date(df[index, "LastModified"])) - } else if (release == 8) { + if (release == 8) { res <- c( - "annotations/GTEx_Analysis_v8_Annotations_SampleAttributesDS.txt", - "annotations/GTEx_Analysis_v8_Annotations_SubjectPhenotypesDS.txt", - paste0("rna_seq_data/GTEx_Analysis_2017-06-05_v8_", - c("RNASeQCv1.1.9_gene_reads.gct.gz", - "STARv2.5.3a_junctions.gct.gz"))) + "annotations/v8/metadata-files/GTEx_Analysis_v8_Annotations_SampleAttributesDS.txt", + "annotations/v8/metadata-files/GTEx_Analysis_v8_Annotations_SubjectPhenotypesDS.txt", + "bulk-gex/v8/rna-seq/GTEx_Analysis_2017-06-05_v8_RNASeQCv1.1.9_gene_reads.gct.gz", + "bulk-gex/v8/rna-seq/GTEx_Analysis_2017-06-05_v8_STARv2.5.3a_junctions.gct.gz") + date <- as.Date("2019-08-26") } else if (release == 7) { - res <- c("annotations/GTEx_v7_Annotations_SampleAttributesDS.txt", - "annotations/GTEx_v7_Annotations_SubjectPhenotypesDS.txt", - paste0("rna_seq_data/GTEx_Analysis_2016-01-15_v7_", - c("RNASeQCv1.1.8_gene_reads.gct.gz", - "STARv2.4.2a_junctions.gct.gz"))) + res <- c( + "annotations/v7/metadata-files/GTEx_v7_Annotations_SampleAttributesDS.txt", + "annotations/v7/metadata-files/GTEx_v7_Annotations_SubjectPhenotypesDS.txt", + "bulk-gex/v7/rna-seq/GTEx_Analysis_2016-01-15_v7_RNASeQCv1.1.8_gene_reads.gct.gz", + "bulk-gex/v7/rna-seq/GTEx_Analysis_2016-01-15_v7_STARv2.4.2a_junctions.gct.gz") + date <- as.Date("2017-09-05") } else if (release == 6) { - res <- c("annotations/GTEx_Data_V6_Annotations_SampleAttributesDS.txt", - "annotations/GTEx_Data_V6_Annotations_SubjectPhenotypesDS.txt", - paste0("rna_seq_data/GTEx_Analysis_v6_RNA-seq_", - c("RNA-SeQCv1.1.8_gene_reads.gct.gz", - "Flux1.6_junction_reads.txt.gz"))) + res <- c( + "annotations/v6/metadata-files/GTEx_Data_V6_Annotations_SampleAttributesDS.txt", + "annotations/v6/metadata-files/GTEx_Data_V6_Annotations_SubjectPhenotypesDS.txt", + "bulk-gex/v6/rna-seq/GTEx_Analysis_v6_RNA-seq_RNA-SeQCv1.1.8_gene_reads.gct.gz", + "bulk-gex/v6/rna-seq/GTEx_Analysis_v6_RNA-seq_Flux1.6_junction_reads.txt.gz") + date <- as.Date("2017-04-25") } else if (release == 4) { res <- c( - "annotations/GTEx_Data_V4_Annotations_SampleAttributesDS.txt", - "annotations/GTEx_Data_V4_Annotations_SubjectPhenotypes_DS.txt", - paste0("rna_seq_data/GTEx_Analysis_V4_RNA-seq_", - c("RNA-SeQCv1.1.8_gene_reads.gct.gz", - "Flux1.6_junction_reads.txt.gz"))) + "annotations/v4/metadata-files/GTEx_Data_V4_Annotations_SampleAttributesDS.txt", + "annotations/v4/metadata-files/GTEx_Data_V4_Annotations_SubjectPhenotypes_DS.txt", + "bulk-gex/v4/rna-seq/GTEx_Analysis_V4_RNA-seq_RNA-SeQCv1.1.8_gene_reads.gct.gz", + "bulk-gex/v4/rna-seq/GTEx_Analysis_V4_RNA-seq_Flux1.6_junction_reads.txt.gz") + date <- as.Date("2017-04-24") + } else if (release == 3) { + res <- c( + "annotations/v3/metadata-files/GTEx_Analysis_Annotations_Sample_DS__Pilot_V3.txt", + "annotations/v3/metadata-files/GTEx_Analysis_Annotations_Subject_DS__Pilot_V3.txt", + "bulk-gex/v3/rna-seq/GTEx_Analysis_RNA-seq_RNA-SeQCv1.1.8_gene_reads__Pilot_V3_patch1.gct.gz", + "bulk-gex/v3/rna-seq/GTEx_Analysis_RNA-seq_Flux1.2.3_junction_readcount__Pilot_V3.txt.gz") + date <- as.Date("2017-04-24") } else { res <- NULL } @@ -230,7 +226,6 @@ getGtexDataURL <- function(release, domain="https://storage.googleapis.com", res <- file.path(domain, path, res) names(res) <- getGtexDataTypes() attr(res, "date") <- date - } return(res) } From cbd710cedb44b7f8a5545b2bed45352ac0f68880 Mon Sep 17 00:00:00 2001 From: Nuno Agostinho Date: Sat, 3 Feb 2024 11:24:54 +0000 Subject: [PATCH 2/5] Fix deprecated use of size in ggplot2::geom_line --- R/analysis_correlation.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/analysis_correlation.R b/R/analysis_correlation.R index d4864bfc..1e6a6499 100644 --- a/R/analysis_correlation.R +++ b/R/analysis_correlation.R @@ -463,7 +463,7 @@ plot.GEandAScorrelation <- function( if (!is(loess, "error")) plot <- plot + geom_line( aes(x=loess$x, y=loess$y), - colour=loessColour, alpha=loessAlpha, size=loessWidth) + colour=loessColour, alpha=loessAlpha, linewidth=loessWidth) } if (density) { From a50b642008b5545a4b30ed674c0149e644a37adc Mon Sep 17 00:00:00 2001 From: Nuno Agostinho Date: Sat, 3 Feb 2024 13:42:31 +0000 Subject: [PATCH 3/5] Fix inconsistency of using survfit --- R/analysis.R | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/R/analysis.R b/R/analysis.R index c1e302ba..680deae7 100644 --- a/R/analysis.R +++ b/R/analysis.R @@ -436,12 +436,12 @@ processSurvTerms <- function(clinical, censoring, event, timeStart, #' survTerms <- processSurvTerms(clinical, censoring="right", event, timeStart, #' formulaStr=formulaStr) #' survfit(survTerms) -survfit.survTerms <- function(survTerms, ...) { - res <- survfit(survTerms$form, data=survTerms$survTime, ...) - res$scale <- survTerms$scale +survfit.survTerms <- function(formula, ...) { + res <- survfit(formula$form, data=formula$survTime, ...) + res$scale <- formula$scale # Correct group names - groups <- deparse(survTerms$form[[3]]) + groups <- deparse(formula$form[[3]]) if (!is.null(res$strata) && groups == "groups") { name <- paste0("^", groups, "=") names(res$strata) <- gsub(name, "", names(res$strata)) From e9f9ae56aa8c02fe2bfdcf1ac5f322bea995bf51 Mon Sep 17 00:00:00 2001 From: Nuno Agostinho Date: Sat, 3 Feb 2024 13:54:37 +0000 Subject: [PATCH 4/5] Update function docs --- DESCRIPTION | 2 +- R/analysis.R | 2 ++ man/calculateLoadingsContribution.Rd | 4 +-- man/colourInputMod.Rd | 1 + man/getClinicalMatchFrom.Rd | 3 +++ man/getDifferentialExpression.Rd | 3 +++ man/getDifferentialSplicing.Rd | 3 +++ man/getGroups.Rd | 3 +++ man/getHighlightedPoints.Rd | 3 +++ man/getSelectedDataPanel.Rd | 3 +++ man/performPCA.Rd | 4 +-- man/plotDistribution.Rd | 40 ++++++++++++++++------------ man/plotICA.Rd | 2 ++ man/processButton.Rd | 2 +- man/processSurvival.Rd | 2 +- man/psichomics.Rd | 2 +- man/styleModal.Rd | 2 +- man/survdiffTerms.Rd | 18 ++++++++++--- man/survfit.survTerms.Rd | 15 ++++------- 19 files changed, 74 insertions(+), 40 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index eb19b081..e2ebc633 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -32,7 +32,7 @@ Depends: shinyBS License: MIT + file LICENSE LazyData: true -RoxygenNote: 7.1.2 +RoxygenNote: 7.3.1 Imports: AnnotationDbi, AnnotationHub, diff --git a/R/analysis.R b/R/analysis.R index 680deae7..9c26bb71 100644 --- a/R/analysis.R +++ b/R/analysis.R @@ -410,6 +410,8 @@ processSurvTerms <- function(clinical, censoring, event, timeStart, #' @inherit survival::survfit title details #' @inheritParams survdiffTerms +#' @param formula \code{survTerms} object: survival terms obtained after +#' running \code{processSurvTerms} (see examples) #' @inheritDotParams survival::survdiff -formula -data #' #' @importFrom survival survfit diff --git a/man/calculateLoadingsContribution.Rd b/man/calculateLoadingsContribution.Rd index 6453d154..6dd7b10d 100644 --- a/man/calculateLoadingsContribution.Rd +++ b/man/calculateLoadingsContribution.Rd @@ -39,7 +39,7 @@ calculateLoadingsContribution(pca) \seealso{ Other functions to analyse principal components: \code{\link{performPCA}()}, -\code{\link{plotPCAvariance}()}, -\code{\link{plotPCA}()} +\code{\link{plotPCA}()}, +\code{\link{plotPCAvariance}()} } \concept{functions to analyse principal components} diff --git a/man/colourInputMod.Rd b/man/colourInputMod.Rd index 77494bbb..8137e5c6 100644 --- a/man/colourInputMod.Rd +++ b/man/colourInputMod.Rd @@ -31,6 +31,7 @@ chosen, the return value is an 8-digit HEX code.} of a HEX value when possible.} \item{\code{closeOnClick}}{If \code{TRUE}, then the colour selection panel will close immediately after selecting a colour.} + \item{\code{width}}{The width of the input, e.g. \code{"400px"} or \code{"100\%"}} }} } \value{ diff --git a/man/getClinicalMatchFrom.Rd b/man/getClinicalMatchFrom.Rd index 89233b0a..a7bdb3d1 100644 --- a/man/getClinicalMatchFrom.Rd +++ b/man/getClinicalMatchFrom.Rd @@ -23,6 +23,9 @@ Getters return globally accessible data, whereas setters return \description{ Get or set clinical matches from a given data type } +\note{ +Needs to be called inside a reactive function +} \seealso{ Other functions to get and set global variables: \code{\link{getDifferentialExpression}()}, diff --git a/man/getDifferentialExpression.Rd b/man/getDifferentialExpression.Rd index 34b2454d..5d13eabd 100644 --- a/man/getDifferentialExpression.Rd +++ b/man/getDifferentialExpression.Rd @@ -51,6 +51,9 @@ Getters return globally accessible data, whereas setters return \description{ Get or set differential expression' elements for a data category } +\note{ +Needs to be called inside a reactive function +} \seealso{ Other functions to get and set global variables: \code{\link{getClinicalMatchFrom}()}, diff --git a/man/getDifferentialSplicing.Rd b/man/getDifferentialSplicing.Rd index 5214dc4e..6cfd358d 100644 --- a/man/getDifferentialSplicing.Rd +++ b/man/getDifferentialSplicing.Rd @@ -51,6 +51,9 @@ Getters return globally accessible data, whereas setters return \description{ Get or set differential splicing' elements for a data category } +\note{ +Needs to be called inside a reactive function +} \seealso{ Other functions to get and set global variables: \code{\link{getClinicalMatchFrom}()}, diff --git a/man/getGroups.Rd b/man/getGroups.Rd index fb9b2655..d512a364 100644 --- a/man/getGroups.Rd +++ b/man/getGroups.Rd @@ -35,6 +35,9 @@ Getters return globally accessible data, whereas setters return \description{ Get or set groups } +\note{ +Needs to be called inside a reactive function +} \seealso{ Other functions to get and set global variables: \code{\link{getClinicalMatchFrom}()}, diff --git a/man/getHighlightedPoints.Rd b/man/getHighlightedPoints.Rd index 5c9b4bb6..c4bf2fe9 100644 --- a/man/getHighlightedPoints.Rd +++ b/man/getHighlightedPoints.Rd @@ -43,6 +43,9 @@ Getters return globally accessible data, whereas setters return \description{ Get or set points or regions for plots } +\note{ +Needs to be called inside a reactive function +} \seealso{ Other functions to get and set global variables: \code{\link{getClinicalMatchFrom}()}, diff --git a/man/getSelectedDataPanel.Rd b/man/getSelectedDataPanel.Rd index 4f9e9ccf..c30a338c 100644 --- a/man/getSelectedDataPanel.Rd +++ b/man/getSelectedDataPanel.Rd @@ -16,6 +16,9 @@ Getters return globally accessible data, whereas setters return \description{ Get or set selected panel in data section } +\note{ +Needs to be called inside a reactive function +} \seealso{ Other functions to get and set global variables: \code{\link{getClinicalMatchFrom}()}, diff --git a/man/performPCA.Rd b/man/performPCA.Rd index 42681b62..43db6e5a 100644 --- a/man/performPCA.Rd +++ b/man/performPCA.Rd @@ -47,7 +47,7 @@ performPCA(USArrests) \seealso{ Other functions to analyse principal components: \code{\link{calculateLoadingsContribution}()}, -\code{\link{plotPCAvariance}()}, -\code{\link{plotPCA}()} +\code{\link{plotPCA}()}, +\code{\link{plotPCAvariance}()} } \concept{functions to analyse principal components} diff --git a/man/plotDistribution.Rd b/man/plotDistribution.Rd index 89076e19..7ed5eb62 100644 --- a/man/plotDistribution.Rd +++ b/man/plotDistribution.Rd @@ -55,18 +55,7 @@ for each group)?} \item{\code{adjust}}{the bandwidth used is actually \code{adjust*bw}. This makes it easy to specify values like \sQuote{half the default} bandwidth.} - \item{\code{kernel}}{a character string giving the smoothing kernel - to be used. This must partially match one of \code{"gaussian"}, - \code{"rectangular"}, \code{"triangular"}, \code{"epanechnikov"}, - \code{"biweight"}, \code{"cosine"} or \code{"optcosine"}, with default - \code{"gaussian"}, and may be abbreviated to a unique prefix (single - letter). - - \code{"cosine"} is smoother than \code{"optcosine"}, which is the - usual \sQuote{cosine} kernel in the literature and almost MSE-efficient. - However, \code{"cosine"} is the version used by S. - } - \item{\code{window}}{a character string giving the smoothing kernel + \item{\code{kernel,window}}{a character string giving the smoothing kernel to be used. This must partially match one of \code{"gaussian"}, \code{"rectangular"}, \code{"triangular"}, \code{"epanechnikov"}, \code{"biweight"}, \code{"cosine"} or \code{"optcosine"}, with default @@ -80,7 +69,17 @@ for each group)?} \item{\code{weights}}{numeric vector of non-negative observation weights, hence of same length as \code{x}. The default \code{NULL} is equivalent to \code{weights = rep(1/nx, nx)} where \code{nx} is the - length of (the finite entries of) \code{x[]}.} + length of (the finite entries of) \code{x[]}. If \code{na.rm = TRUE} + and there are \code{NA}'s in \code{x}, they \emph{and} the + corresponding weights are removed before computations. In that case, + when the original weights have summed to one, they are re-scaled to + keep doing so. + + Note that weights are \emph{not} taken into account for automatic + bandwidth rules, i.e., when \code{bw} is a string. When the weights + are proportional to true counts \code{cn}, \code{density(x = rep(x, cn))} + may be used instead of \code{weights}. + } \item{\code{width}}{this exists for compatibility with S; if given, and \code{bw} is not, will set \code{bw} to \code{width} if this is a character string, or to a kernel-dependent multiple of \code{width} @@ -88,16 +87,23 @@ for each group)?} \item{\code{give.Rkern}}{logical; if true, \emph{no} density is estimated, and the \sQuote{canonical bandwidth} of the chosen \code{kernel} is returned instead.} + \item{\code{subdensity}}{used only when \code{weights} are specified which do not sum + to one. When true, it indicates that a \dQuote{sub-density} + is desired and no warning should be signalled. By default, when false, + a \code{\link{warning}} is signalled when the weights do not sum to one.} + \item{\code{warnWbw}}{\code{\link{logical}}, used only when \code{weights} are specified \emph{and} + \code{bw} is \code{character}, i.e., automatic bandwidth selection is + chosen (as by default). When true (as by default), a + \code{\link{warning}} is signalled to alert the user that automatic + bandwidth selection will not take the weights into account and hence + may be suboptimal.} \item{\code{n}}{the number of equally spaced points at which the density is to be estimated. When \code{n > 512}, it is rounded up to a power of 2 during the calculations (as \code{\link[stats]{fft}} is used) and the final result is interpolated by \code{\link[stats]{approx}}. So it almost always makes sense to specify \code{n} as a power of two. } - \item{\code{from}}{the left and right-most points of the grid at which the - density is to be estimated; the defaults are \code{cut * bw} outside - of \code{range(x)}.} - \item{\code{to}}{the left and right-most points of the grid at which the + \item{\code{from,to}}{the left and right-most points of the grid at which the density is to be estimated; the defaults are \code{cut * bw} outside of \code{range(x)}.} \item{\code{cut}}{by default, the values of \code{from} and \code{to} are diff --git a/man/plotICA.Rd b/man/plotICA.Rd index e3fefb81..19f478bb 100644 --- a/man/plotICA.Rd +++ b/man/plotICA.Rd @@ -39,6 +39,8 @@ symbols (default 0.9).} hovering over an observation. You can include basic html.} \item{\code{leftmar}}{space on the left margin} \item{\code{topmar}}{space on the bottom margin} + \item{\code{diag}}{logical, whether or not the main diagonal is plotted +(scatter plot of variables against themselves).} }} } \value{ diff --git a/man/processButton.Rd b/man/processButton.Rd index b6207a48..2cc7ced3 100644 --- a/man/processButton.Rd +++ b/man/processButton.Rd @@ -16,7 +16,7 @@ processButton(id, label, ..., class = "btn-primary") \describe{ \item{\code{icon}}{An optional \code{\link[shiny:icon]{icon()}} to appear on the button.} \item{\code{width}}{The width of the input, e.g. \code{'400px'}, or \code{'100\%'}; -see \code{\link[shiny:reexports]{validateCssUnit()}}.} +see \code{\link[shiny:validateCssUnit]{validateCssUnit()}}.} }} \item{class}{Character: class} diff --git a/man/processSurvival.Rd b/man/processSurvival.Rd index 0893106b..e18e63a6 100644 --- a/man/processSurvival.Rd +++ b/man/processSurvival.Rd @@ -20,6 +20,7 @@ processSurvival(session, ...) \item{\code{coxph}}{Boolean: fit a Cox proportional hazards regression model?} \item{\code{survTime}}{\code{survTime} object: times to follow up, time start, time stop and event (optional)} + \item{\code{group}}{Character: group relative to each subject} \item{\code{clinical}}{Data frame: clinical data} \item{\code{event}}{Character: name of column containing time of the event of interest} @@ -27,7 +28,6 @@ interest} interval or follow up time} \item{\code{timeStop}}{Character: name of column containing ending time of the interval (only relevant for interval censoring)} - \item{\code{group}}{Character: group relative to each subject} \item{\code{followup}}{Character: name of column containing follow up time} }} } diff --git a/man/psichomics.Rd b/man/psichomics.Rd index e00b802a..8831551f 100644 --- a/man/psichomics.Rd +++ b/man/psichomics.Rd @@ -42,7 +42,7 @@ only used for recording or running automated tests. Defaults to the \item{launch.browser}{If true, the system's default web browser will be launched automatically after the app is started. Defaults to true in -interactive sessions only. This value of this parameter can also be a +interactive sessions only. The value of this parameter can also be a function to call with the application's URL.} \item{shinyproxy}{Boolean: prepare visual interface to run in Shinyproxy?} diff --git a/man/styleModal.Rd b/man/styleModal.Rd index 8b369696..1286c2e9 100644 --- a/man/styleModal.Rd +++ b/man/styleModal.Rd @@ -38,7 +38,7 @@ infoModal(session, title, ..., size = "small", footer = NULL, caller = NULL) clicking outside the dialog box, or be pressing the Escape key. If \code{FALSE} (the default), the modal dialog can't be dismissed in those ways; instead it must be dismissed by clicking on a \code{modalButton()}, or -from a call to \code{\link[shiny:showModal]{removeModal()}} on the server.} +from a call to \code{\link[shiny:removeModal]{removeModal()}} on the server.} \item{\code{fade}}{If \code{FALSE}, the modal dialog will have no fade-in animation (it will simply appear rather than fade in to view).} }} diff --git a/man/survdiffTerms.Rd b/man/survdiffTerms.Rd index 4ba78730..8e1404f6 100644 --- a/man/survdiffTerms.Rd +++ b/man/survdiffTerms.Rd @@ -41,7 +41,7 @@ defined for \code{survfit} objects are \code{print}, \code{plot}, Tests if there is a difference between two or more survival curves using the \eqn{G^\rho}{G-rho} family of tests, or for a single curve against a known alternative. } -\section{METHOD}{ +\section{Description}{ This function implements the G-rho family of Harrington and Fleming (1982), with weights on each death of \eqn{S(t)^\rho}{S(t)^rho}, @@ -50,12 +50,17 @@ With \code{rho = 0} this is the log-rank or Mantel-Haenszel test, and with \code{rho = 1} it is equivalent to the Peto & Peto modification of the Gehan-Wilcoxon test. +Peto and Peto show that the Gehan-Wilcoxon test can be badly biased if +the two groups have different censoring patterns, and proposed an +alternative. Prentice and Marek later showed an actual example where this +issue occurs. For most data sets the Gehan-Wilcoxon and +Peto-Peto-Prentice variant will hardly differ, however. If the right hand side of the formula consists only of an offset term, then a one sample test is done. To cause missing values in the predictors to be treated as a separate group, rather than being omitted, use the \code{factor} function with its -\code{exclude} argument. +\code{exclude} argument to recode the righ-hand-side covariate. } @@ -80,8 +85,13 @@ survdiffTerms(survTerms) \references{ Harrington, D. P. and Fleming, T. R. (1982). A class of rank test procedures for censored survival data. -\emph{Biometrika} -\bold{69}, 553-566. + Biometrika, 553-566. + + Peto R. Peto and Peto, J. (1972) Asymptotically efficient rank invariant + test procedures (with discussion), JRSSA, 185-206. + + Prentice, R. and Marek, P. (1979) A qualitative discrepancy between + censored data rank tests, Biometics, 861--867. } \seealso{ Other functions to analyse survival: diff --git a/man/survfit.survTerms.Rd b/man/survfit.survTerms.Rd index c71e4593..a1f2e279 100644 --- a/man/survfit.survTerms.Rd +++ b/man/survfit.survTerms.Rd @@ -4,10 +4,10 @@ \alias{survfit.survTerms} \title{Create survival curves} \usage{ -\method{survfit}{survTerms}(survTerms, ...) +\method{survfit}{survTerms}(formula, ...) } \arguments{ -\item{survTerms}{\code{survTerms} object: survival terms obtained after +\item{formula}{\code{survTerms} object: survival terms obtained after running \code{processSurvTerms} (see examples)} \item{...}{ @@ -48,8 +48,9 @@ A survival curve is based on a tabulation of the number at risk and For further details see the documentation for the appropriate method, i.e., \code{?survfit.formula} or \code{?survfit.coxph}. - A survfit object may contain a single curve, a set of curves, or a - matrix curves. + A survfit object may contain a single curve, a set of curves (vector), a + matrix of curves, or even a 3 way array: \code{dim(fit)} will reveal + the dimensions. Predicted curves from a \code{coxph} model have one row for each stratum in the Cox model fit and one column for each specified covariate set. @@ -57,12 +58,6 @@ A survival curve is based on a tabulation of the number at risk and a column for each state, the strata correspond to predictors on the right hand side of the equation. The default printing and plotting order for curves is by column, as with other matrices. - - Curves can be subscripted using either a single or double subscript. - If the set of curves is a matrix, as in the above, and one of the - dimensions is 1 then the code allows a single subscript to be used. - (That is, it is not quite as general as using a single subscript for - a numeric matrix.) } \examples{ library("survival") From ce4e0fb6c2d5f746dc6cdf82473ab3d1a8ab28db Mon Sep 17 00:00:00 2001 From: Nuno Agostinho Date: Sun, 4 Feb 2024 10:56:14 +0000 Subject: [PATCH 5/5] Set seed when creating PSI datasets for reproducibility of unit test --- tests/testthat/testDiscardLowCoveragePSIs.R | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/testthat/testDiscardLowCoveragePSIs.R b/tests/testthat/testDiscardLowCoveragePSIs.R index 9b50a9b9..2fc592b4 100644 --- a/tests/testthat/testDiscardLowCoveragePSIs.R +++ b/tests/testthat/testDiscardLowCoveragePSIs.R @@ -1,6 +1,7 @@ context("Discard low coverage PSI values") createPSIdataset <- function(samples=20, events=50) { + set.seed(639245) size <- samples * events num <- sample(seq(100), size, replace=TRUE) num[sample(size, size / 10)] <- NA