Skip to content

Instantly share code, notes, and snippets.

@danielecook
Last active May 12, 2020 16:28
Show Gist options
  • Save danielecook/dd109c5a4df17a3a65e30eb9f0f23f76 to your computer and use it in GitHub Desktop.
Save danielecook/dd109c5a4df17a3a65e30eb9f0f23f76 to your computer and use it in GitHub Desktop.
Parse format column in R
parse_format_column <-
df[, .(rbindlist(
purrr::map2(
strsplit(vcf_format, ":", fixed=TRUE),
strsplit(vcf_gt, ":", fixed=TRUE),
function(x, y) { names(y) <- x; data.table(t(y)) }
)
)
),
]
parse_format_column <- hablar::retype(parse_format_column)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment