-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathratee.R
32 lines (26 loc) · 830 Bytes
/
ratee.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Sidenote: Parse RATEE
library(tidyr)
library(dplyr)
library(tibble)
library(xml2)
ratee <- "C:/Users/Ethan/Documents/edge/edgexml/XML XSD/DDC_RATEE_XSD_XML_083019/RATransferElementsExtract.xml"
tbl_ratee <- read_xml(ratee) %>%
as_list() %>%
as_tibble() %>%
unnest_wider(raTransferReport)
tbl_head <- tbl_ratee %>%
select(outboundFileIdentifier:issuerIdentifier) %>%
filter(outboundFileIdentifier != "NA") %>%
unnest(cols = names(.))
tbl_body <- tbl_ratee %>%
select(planIdentifier:includedRatingAreaCategory) %>%
filter(planIdentifier != "NA") %>%
unnest(1:4) %>%
pivot_longer(cols = starts_with("includedRatingAreaCategory")) %>%
select(-name) %>%
filter(value != "NA")
tbl_main <- tbl_body %>%
unnest_wider(value) %>%
unnest(cols = names(.)) %>%
unnest(cols = names(.))
tbl_main %>% View()