
GCES would like the option to reformat the MA Extraction spreadsheet to have interventions in the column headers instead of rows.
e.g. Column Header 1: Arm A - Data Element 1; Column Header 2: Arm B Data Element 2 and so on.


Thanks for the request! It’s currently formatted as “long” data by popular demand from other users and because most statistical modeling libraries (in R, at least) we’re familiar with prefer this format.
We’ll certainly take votes on this! In the meantime, R users may pivot their data to a wide format like this:
library(tidyverse)
nk_df <- read.csv('~/Downloads/demo_extraction.csv', check.names = FALSE) %>%
filter(Intervention != '') %>%
mutate(across(everything(), as.character))
intervention_ix <- which(colnames(nk_df) == 'Intervention')
wider_df <- nk_df %>%
pivot_longer(-colnames(nk_df)[1:intervention_ix], names_to='data_element', values_to ='value') %>%
pivot_wider(,
names_from=c(data_element, Intervention),
values_from =c(value)
)
wider_df %>% write.csv('~/Downloads/wider_extraction.csv', na="")