gf2list: Convert a Gadget file to a list of components based on a...

Description Usage Arguments Value Examples

Description

Gadget files often contain information about a number of components that are divided by a regular expression (often [component]). gf2list converts the direct output from, say, a readLines(x) call into a list that can be named

Usage

1
gf2list(x, split = "^\\[component\\]$", list_names = FALSE)

Arguments

x

Vector of character vectors of a raw Gadget file

split

Regular expression to split by

list_names

Optional. If TRUE, gf2list will name the components of x by the first character vector in each component. Otherwise a character vector of names the length of x can be supplied

Value

A list of components from a Gadget file

Examples

1
2
3
4
path <- system.file(gad_mod_dir, package = "gadgetSim")
raw_lik <- readLines(paste(path, "likelihood", sep = "/"))
gf2list(raw_lik)
gf2list(raw_lik, list_names = TRUE)

inspktrgadget/gadgetSim documentation built on May 10, 2019, 9:51 a.m.