### Install Development Version of pROC R Package Source: https://github.com/xrobin/proc/blob/master/README.md Provides instructions for installing the development version of the pROC package directly from GitHub using the `devtools` package. This allows users to access the latest features and bug fixes before they are officially released on CRAN. ```R if (! requireNamespace("devtools")) install.packages("devtools") devtools::install_github("xrobin/pROC@develop") ``` -------------------------------- ### Install pROC R Package from CRAN Source: https://github.com/xrobin/proc/blob/master/README.md Installs the stable version of the pROC package directly from CRAN (Comprehensive R Archive Network). This is the recommended method for most users to get the latest stable release. ```R install.packages("pROC") ``` -------------------------------- ### Compare Multiple ROC Curves Source: https://github.com/xrobin/proc/blob/master/README.md Performs statistical tests to compare two ROC curves. Examples include testing the significance of differences in the whole AUC, a partial AUC, and modifying bootstrap parameters for the comparison test to control for variability. ```R # Test on the whole AUC roc.test(roc1, roc2, reuse.auc=FALSE) # Test on a portion of the whole AUC roc.test(roc1, roc2, reuse.auc=FALSE, partial.auc=c(100, 90), partial.auc.focus="se", partial.auc.correct=TRUE) # With modified bootstrap parameters roc.test(roc1, roc2, reuse.auc=FALSE, partial.auc=c(100, 90), partial.auc.correct=TRUE, boot.n=1000, boot.stratified=FALSE) ``` -------------------------------- ### Extract Specific Coordinates from ROC Curve Source: https://github.com/xrobin/proc/blob/master/README.md Retrieves specific coordinates from a generated ROC curve. Examples include finding the 'best' threshold based on a criterion and extracting multiple metrics (sensitivity, specificity, predictive values) at 'local maximas' of the curve. ```R coords(roc1, "best", ret=c("threshold", "specificity", "1-npv")) coords(roc2, "local maximas", ret=c("threshold", "sens", "spec", "ppv", "npv")) ``` -------------------------------- ### Load pROC Package and Sample Data Source: https://github.com/xrobin/proc/blob/master/README.md Loads the pROC package into the R session, making its functions available for use. Subsequently, it loads the 'aSAH' sample dataset, which is included with the package, for demonstration purposes. ```R library(pROC) data(aSAH) ``` -------------------------------- ### Run R Package Checks with devtools (R Console) Source: https://github.com/xrobin/proc/blob/master/README.md This R snippet shows how to run standard package checks using the `devtools::check()` function from within an R command prompt. It provides a convenient way to perform checks during development without leaving the R environment. ```R devtools::check() ``` -------------------------------- ### Run All Automated R Checks and Tests (Shell) Source: https://github.com/xrobin/proc/blob/master/README.md This snippet demonstrates how to perform a comprehensive check of an R package, including slow tests, directly from the command line. It involves building the package and then running `R CMD check` with a `RUN_SLOW_TESTS` environment variable set to true. This method is typically executed from the parent directory of the package. ```Shell cd .. # Run from parent directory VERSION=$(grep Version pROC/DESCRIPTION | sed "s/.+ //") R CMD build pROC RUN_SLOW_TESTS=true R CMD check pROC_$VERSION.tar.gz ``` -------------------------------- ### Run vdiffr Visual Tests and Review Snapshots (R Console) Source: https://github.com/xrobin/proc/blob/master/README.md This R snippet details the process of running visual tests using the `vdiffr` package, which is essential for plot regression testing. It includes running `devtools::test()` to execute the tests and `testthat::snapshot_review()` to interactively review and approve any new or changed plot snapshots. ```R run_slow_tests <- TRUE devtools::test() # Must run the new tests testthat::snapshot_review() ``` -------------------------------- ### Configure Advanced ROC Options, Confidence Intervals, and Plotting Source: https://github.com/xrobin/proc/blob/master/README.md Demonstrates how to generate an ROC curve with extensive options, including partial AUC calculation, confidence interval bootstrapping, and direct plotting with various visual enhancements. It also shows how to add a second ROC curve to an existing plot, ensuring consistent 'percent' specification. ```R roc1 <- roc(aSAH$outcome, aSAH$s100b, percent=TRUE, # arguments for auc partial.auc=c(100, 90), partial.auc.correct=TRUE, partial.auc.focus="sens", # arguments for ci ci=TRUE, boot.n=100, ci.alpha=0.9, stratified=FALSE, # arguments for plot plot=TRUE, auc.polygon=TRUE, max.auc.polygon=TRUE, grid=TRUE, print.auc=TRUE, show.thres=TRUE) # Add to an existing plot. Beware of 'percent' specification! roc2 <- roc(aSAH$outcome, aSAH$wfns, plot=TRUE, add=TRUE, percent=roc1$percent) ``` -------------------------------- ### Run Automated R Package Tests with devtools (R Console) Source: https://github.com/xrobin/proc/blob/master/README.md This R snippet illustrates how to execute automated tests for an R package using `devtools::test()`. An optional `run_slow_tests` variable can be set to `TRUE` to include tests marked as slow, providing flexibility in the testing scope. ```R run_slow_tests <- TRUE # Optional, include slow tests devtools::test() ``` -------------------------------- ### Build and Check R Package for CRAN Submission (Shell) Source: https://github.com/xrobin/proc/blob/master/README.md This shell command is a crucial step in the R package release process. It builds the package into a `.tar.gz` archive and then performs a thorough check using `R CMD check --as-cran`, ensuring compliance with CRAN submission policies. ```Shell R CMD build pROC && R CMD check --as-cran pROC_$VERSION.tar.gz ``` -------------------------------- ### Git Operations for R Package Release (Shell) Source: https://github.com/xrobin/proc/blob/master/README.md These shell commands are standard Git operations performed during the release of an R package. They involve merging the development branch into master, creating a version tag, and pushing the tags to the remote repository, marking the official release point. ```Shell git checkout master && git merge develop git tag v$VERSION && git push --tags ``` -------------------------------- ### Run R CMD Check with vdiffr (Shell) Source: https://github.com/xrobin/proc/blob/master/README.md This shell command demonstrates how to integrate `vdiffr` visual tests into the standard `R CMD check` process. By setting the `NOT_CRAN=1` environment variable, checks that are typically skipped on CRAN (like `vdiffr`'s interactive snapshot review) are enabled, allowing for a more comprehensive local check. ```Shell NOT_CRAN=1 RUN_SLOW_TESTS=true R CMD check pROC_$VERSION.tar.gz ``` -------------------------------- ### Check R Package Compatibility with R-devel (R Console) Source: https://github.com/xrobin/proc/blob/master/README.md This R snippet uses the `rhub` package to check the R package against the development version of R (`R-devel`) on various platforms. This is a critical step before CRAN submission to identify potential compatibility issues early. ```R rhub::check_for_cran() ``` -------------------------------- ### Calculate and Plot Confidence Intervals for ROC Analysis Source: https://github.com/xrobin/proc/blob/master/README.md Demonstrates how to calculate confidence intervals for the AUC and for the ROC curve itself (e.g., sensitivity at specificities). It also shows how to plot these confidence intervals as shapes or bars, and how to plot confidence intervals for thresholds. ```R # Of the AUC ci(roc2) # Of the curve sens.ci <- ci.se(roc1, specificities=seq(0, 100, 5)) plot(sens.ci, type="shape", col="lightblue") plot(sens.ci, type="bars") # need to re-add roc2 over the shape plot(roc2, add=TRUE) # CI of thresholds plot(ci.thresholds(roc2)) ``` -------------------------------- ### Check R Package Reverse Dependencies (R Console) Source: https://github.com/xrobin/proc/blob/master/README.md This R snippet utilizes the `revdepcheck` package to verify that the current package changes do not break any other packages that depend on it. It's an essential step for maintaining ecosystem stability, allowing for parallel processing and a configurable timeout. ```R revdepcheck::revdep_check(num_workers=8, timeout = as.difftime(60, units = "mins")) ``` -------------------------------- ### Check R Package with Slow Tests Enabled (Shell) Source: https://github.com/xrobin/proc/blob/master/README.md This shell command is part of the release checklist, specifically for verifying the package's behavior when slow tests are included. Setting `NOT_CRAN=1` and `RUN_SLOW_TESTS=true` ensures that all tests, including those that are time-consuming, are executed during the `R CMD check`. ```Shell NOT_CRAN=1 RUN_SLOW_TESTS=true R CMD check pROC_$VERSION.tar.gz ``` -------------------------------- ### Perform Basic ROC and AUC Analysis Source: https://github.com/xrobin/proc/blob/master/README.md Calculates the Receiver Operating Characteristic (ROC) curve and Area Under the Curve (AUC) for a given outcome and predictor variable. This snippet demonstrates two common syntax options: direct variable access using '$' and formula notation. ```R roc(aSAH$outcome, aSAH$s100b) roc(outcome ~ s100b, aSAH) ``` -------------------------------- ### Calculate Sample Size for ROC Studies Source: https://github.com/xrobin/proc/blob/master/README.md Determines the required sample size for ROC curve studies. It supports calculations for comparing two ROC curves or for a single ROC curve, allowing specification of AUC, number of cases/controls, desired power, and significance level. ```R # Two ROC curves power.roc.test(roc1, roc2, reuse.auc=FALSE) power.roc.test(roc1, roc2, power=0.9, reuse.auc=FALSE) # One ROC curve power.roc.test(auc=0.8, ncases=41, ncontrols=72) power.roc.test(auc=0.8, power=0.9) power.roc.test(auc=0.8, ncases=41, ncontrols=72, sig.level=0.01) power.roc.test(ncases=41, ncontrols=72, power=0.9) ``` -------------------------------- ### Smooth ROC Curve Source: https://github.com/xrobin/proc/blob/master/README.md Generates a smoothed ROC curve using the formula notation. The `smooth=TRUE` argument applies a smoothing algorithm to the curve, which can be useful for visualizing trends in noisy data. ```R roc(outcome ~ s100b, aSAH, smooth=TRUE) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.