"Flattening" a ndoe value means pasting together all values in the vector to one character value.

flattenNodeValue(singleValue)

flattenNodeValues(x, list = FALSE)

Arguments

singleValue

The single node value

x

A list of node values

list

Whether to return the result as a vector (FALSE) or as a list (TRUE).

Value

A character value, or a vector of values.

Examples

metabefor::flattenNodeValue(1:8);
#> [1] "'1', '2', '3', '4', '5', '6', '7' & '8'"

metabefor::flattenNodeValues(
  list(
    firstElement = 1:8,
    secondElement = letters[1:4],
    thirdElement = LETTERS[10:17]
  )
);
#>                              firstElement 
#> "'1', '2', '3', '4', '5', '6', '7' & '8'" 
#>                             secondElement 
#>                     "'a', 'b', 'c' & 'd'" 
#>                              thirdElement 
#> "'J', 'K', 'L', 'M', 'N', 'O', 'P' & 'Q'" 

### Or get the results as a list
metabefor::flattenNodeValues(
  list(
    firstElement = 1:8,
    secondElement = letters[1:4],
    thirdElement = LETTERS[10:17]
  ),
  list = TRUE
);
#> $firstElement
#> [1] "'1', '2', '3', '4', '5', '6', '7' & '8'"
#> 
#> $secondElement
#> [1] "'a', 'b', 'c' & 'd'"
#> 
#> $thirdElement
#> [1] "'J', 'K', 'L', 'M', 'N', 'O', 'P' & 'Q'"
#>