idx_invcov | R Documentation |
With code by Cyrus Samii, see https://github.com/cdsamii/make_index/blob/master/r/index_comparison.R
idx_invcov(..., wt, fill_na = TRUE, na.rm = TRUE)
... |
One or more unquoted variables |
fill_na |
Option to fill missing values from any variable with linear predictions from all of the other variables. |
na.rm |
Option to remove NA's when calculating mean index. |
A vector with the mean index
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_invcov(var1, var2, var3)
library(dplyr)
df <- tibble(var1, var2, var3)
mutate(df, idx_var = idx_invcov(var1, var2, var3))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.