diff --git a/data-src/positions_by_chart_type.R b/data-src/positions_by_chart_type.R new file mode 100644 index 0000000..d1968e2 --- /dev/null +++ b/data-src/positions_by_chart_type.R @@ -0,0 +1,17 @@ +library(xml2) +library(magrittr) +library(purrr) +library(dplyr) +library(officer) + +label_doc <- unpack_folder("inst/ressources/model_labels_pos.pptx", tempdir()) +all_xml <- list.files( file.path(label_doc, "ppt/charts"), pattern = "\\.xml$", full.names = TRUE ) +all_doc <- map(all_xml, read_xml) +pos <- map( all_doc, xml_find_first, "//c:dLblPos") %>% map_chr(xml_attr, "val") +grouping <- map( all_doc, xml_find_first, "//c:grouping") %>% map_chr(xml_attr, "val") +type <- map( all_doc, xml_find_first, "//c:chart/c:plotArea") %>% + map(xml_child, 2) %>% + map_chr(xml_name) + +tibble::tibble(type= type, grouping = grouping, pos=pos) %>% + arrange(type, grouping, pos) %>% distinct()