knitr::opts_chunk$set( collapse = TRUE, message = FALSE, warning = FALSE, error = FALSE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" ) set.seed(42)
This small package provides a set of simple tools for standardizing variables (based on summary statistics from another variable or a subset, such as a control group in an experiment) and constructing indices of multiple variables. It provides simple mean indexing and inverse covariance-weighted indices.
Install the development version from GitHub with:
# install.packages("devtools") devtools::install_github("graemeblair/stdidx")
This is a basic example which shows you how to solve a common problem:
library(stdidx) var1 <- rnorm(100, mean = 0.5, sd = 0.25) var2 <- rnorm(100, mean = -1, sd = 0.5) var3 <- rnorm(100, mean = 1, sd = 1) idx <- idx_mean(var1, var2, var3) head(idx)
stdidx
is set up to work with a tidyverse
workflow out of the box:
library(dplyr) df <- tibble(var1, var2, var3) df %>% mutate(idx_var = idx_mean(var1, var2, var3)) %>% head
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.