Skip to content

Instantly share code, notes, and snippets.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
library(data.table)

q <- c(0.001,
       0.002,
       0.003,
       0.003,
       0.004,
       0.004,
 0.005,
@Houstonwp
Houstonwp / parse_soa_select_mort_table.R
Created May 29, 2019 20:14
Parse SOA Select Mortality Table
library(tidyverse)
library(xml2)
parse_select <- function(.path) {
possibly_read_xml <- purrr::possibly(read_xml, otherwise = NULL)
.xml <- possibly_read_xml(.path)
if (!is.null(.xml)) {
min_duration <-
.xml %>%
xml_find_all("//Table/MetaData/AxisDef[@id='Duration']/MinScaleValue") %>%
@Houstonwp
Houstonwp / get_SOA_mort_table_info.R
Created May 29, 2019 20:12
Get SOA Mortality Table Information
library(tidyverse)
library(xml2)
get_table_info <- function(.path) {
possibly_read_xml <- purrr::possibly(read_xml, otherwise = NULL)
.xml <- possibly_read_xml(.path)
if (!is.null(.xml)) {
table_info_columns <-
.xml %>%
xml_find_all("//ContentClassification") %>%