idx_mean | R Documentation |
Create Mean Index from Several Variables
idx_mean(..., 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_mean(var1, var2, var3)
library(dplyr)
df <- tibble(var1, var2, var3)
mutate(df, idx_var = idx_mean(var1, var2, var3))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.