knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(msni19)

Example input

input <- read.csv("../tests/testthat/possible_inputs.csv")
input
head(input) %>% (knitr::kable) %>% (kableExtra::kable_styling)

Calculating the msni score:

msni_score <- msni(education = input$education,
     fsl_lsg = input$fsl,
     health_lsg = input$fsl,
     protection_lsg = input$protection,
     shelter_lsg = input$shelter,
     wash_lsg = input$wash,
     capacity_gaps = input$capacity_gaps,
     impact = input$impact)

the result is a vector:

head(msni_score)
hist(msni_score)

You can add additional variables as custom arguments (in dots ...). they will be treated exactly like education_lsg:

another_source_index_that_is_not_in_the_original_msni <- runif(500,1,4)
custom_msni_score <- msni(education_lsg = input$education,
     fsl_lsg = input$fsl,
     health_lsg = input$health,
     protection_lsg = input$protection,
     shelter_lsg = input$shelter,
     wash_lsg = input$wash,
     capacity_gaps = input$capacity_gaps,
     impact = input$impact,
     another_source_index_that_is_not_in_the_original_msni
     )

head(custom_msni_score)

Please find details on the methodology in this dedicated vignette.



mabafaba/msni19 documentation built on Aug. 28, 2019, 9:51 a.m.