knitr::opts_chunk$set(
  collapse = TRUE,
  message = FALSE,
  warning = FALSE,
  error = FALSE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

set.seed(42)

stdidx

Lifecycle: experimental CRAN status

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.

Installation

Install the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("graemeblair/stdidx")

Example

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


graemeblair/stdidx documentation built on April 19, 2023, 6:48 a.m.