listToRCode: Translates a nested list (as provided by a yaml file) into R...

View source: R/package_maintenance.R

listToRCodeR Documentation

Translates a nested list (as provided by a yaml file) into R code defining the lists

Description

Translates a nested list (as provided by a yaml file) into R code defining the lists

Usage

listToRCode(obj, indent = "    ", indentShift = "")

Arguments

obj

list; Nested list to be translated. The allowed list elements are: list, character, numeric, logical

indent

character (optional) (default: ' '[4 whitespaces]); Character(s) used for the indentation. Default: <tab>

indentShift

character (optional) (default: ”); Shifts the block to the right by putting the characters before each line (mostly used in internal recursion)

Value

character; R code for generating the nested list

Note

only for package maintenance!

Examples

test = list(bla='some text',blubb=list(a='more text', version='2.0'),justANumber=123456)
#$bla
#[1] "some text"
#$blubb
#$blubb$a
#[1] "more text"
#$blubb$version
#[1] "2.0"
#$justANumber
#[1] 123456
#
#listToRCode(test)
#[1] "list(\n\tbla=\"some text\",\n\tblubb=list(\n\t\ta=\"more text\",\n\t\tversion=\"2.0\"\n\t)\n)"

frankkramer-lab/ndexr documentation built on April 4, 2023, 7:19 p.m.