Tag: R


Anatomy of a Diagnostic Test – an R Shiny Example by Saunak Sen

|

The positive and negative predictive values of a dignostic test depend not only on its sensitivity and specificity, but also the prevalence of the disease (or the pre-test probability of disease).  This interactive display illustrates that inter-dependence. Move the sensitivity, specificity, and disease prevalence sliders, and watch the positive and negative predictive value sliders change… Read More

Equivalent of SAS Macros in R – Loops and Functions by Courtney Gale

|

If you’re an avid SAS user, you’re likely very familiar with SAS macros. SAS macros are a key component to creating efficient and concise code. Although you cannot use macros in R, R offers other features like functions and loops that can perform the same tasks as SAS macros. Using apply() to loop over variables… Read More

A SAS Macro/R Code Comparison: Generating Multiple Datasets by Tristan Hayes

|

This is a short comparison of SAS and R code in the context of generating multiple datasets. In this example, the mpg dataset from R is used to show how one might use a SAS Macro to subset the data by car class, followed by the R equivalent. You will see that in SAS, the macro… Read More