vectorValue_to_valueList.Rd
For example, c('red', 'brown')
becomes list(red = 1, brown = 1)
.
rxsProject_vectorValue_to_valueList(x, entityId, allPossibleValues = NULL)
rxsTreeList_vectorValue_to_valueList(x, entityId, allPossibleValues = NULL)
rxsTree_vectorValue_to_valueList(x, entityId, allPossibleValues = NULL)
vectorValue_to_valueList(
value,
allPossibleValues = NULL,
labels = NULL,
valueForPresence = 1,
valueForAbsence = 0
)
A Rxs tree
The entity Id
A list of all possible values
The vector value to convert
Optionally, a named vector with labels to replace the actual values with; names are values, values are labels.
Value to assign for the elements in the vector
Value to assign for the elements
in allPossibleValues
that do not occur in the vector
The Rxs tree specified in x
, invisibly.
The list
### Load an example Rxs project
data('example_rxsProject_1', package="metabefor");
### Look at the sample size specified in
### an Rxs tree for a source
example_rxsProject_1$rxsTrees$qurid_7h50rzmz$methods$sample$sampleSize$value;
#> [1] 2
### Set it to a vector
example_rxsProject_1$rxsTrees$qurid_7h50rzmz$methods$sample$sampleSize$value <-
c(80, 62);
### Convert the values to a value list
rxsTree_vectorValue_to_valueList(
example_rxsProject_1$rxsTrees$qurid_7h50rzmz,
"sampleSize"
);
### Verify that this happened
example_rxsProject_1$rxsTrees$qurid_7h50rzmz$methods$sample$sampleSize$value;
#> $`80`
#> [1] 1
#>
#> $`62`
#> [1] 1
#>
### Example for one vector
metabefor::vectorValue_to_valueList(
c('red', 'brown')
);
#> $red
#> [1] 1
#>
#> $brown
#> [1] 1
#>