Skip to content

Commit

Permalink
data-src
Browse files Browse the repository at this point in the history
  • Loading branch information
davidgohel committed Dec 10, 2017
1 parent d5544c0 commit 6b9548b
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions 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()

0 comments on commit 6b9548b

Please sign in to comment.