This function takes a full Rxs project (as produced by rxs_parseExtractionScripts()) and processes all Rxs trees, looking for the values stored in the entity with the specified identifier (this cannot be a clustering entity or a clustered entity; see the definitions at, compiling a list of all occurring values, and then adds new entities for each occurring value, with new values (by default, 0 and 1) indicating whether that value occurred in the original vector for a given entity.

  prefix = NULL,
  values = 0:1,
  valueDict = NULL



The full Rxs project object (as produced by rxs_parseExtractionScripts()).


The entity identifier.


The prefix to use to create the new entity names.


The values to store to represent, respectively, that a value did not or did occur in the original vector.


Optionally, a dictionary that will be used to convert values to entity identifiers (i.e. the bit appended to the prefix). If nothing is specified, the original values will be sanitized and used.


Invisibly, the full Rxs project object. Note that the Rxs trees will be changed in place given data.tree's pass-by-reference logic; so you can discard the result if you want.


For example, imagine the following situation. We want to process an entity called exampleVector in three Rxs trees. In the first Rxs tree, that entity contains the value c("a", "b"); in the second Rxs tree, it contains c("a", "c", "d"); and in the third Rxs tree, it doesn't exist. If we would then run this function with its default arguments, in all three Rxs trees, four new entities will be added, exampleVector_a, exampleVector_b, exampleVector_c, and exampleVector_d. In the first Rxs tree, the values would be, respectively, 1, 1, 0, and 0; in the second, they would be 1, 0, 1, and 1; and in the third Rxs tree, they would all be 0 (see the example).


### Create fake Rxs project
rxs <-
  list(rxsTrees = list());
class(rxs) <-
### Add three fake sources
rxs$rxsTrees <-
  list(source1 = data.tree::Node$new("source"),
       source2 = data.tree::Node$new("source"),
       source3 = data.tree::Node$new("source"));

### Add values for an entity with id 'exampleVector'
  "exampleVector", value=c("a", "b")
  "exampleVector", value=c("a", "c", "d")

### Explore this vector
explode_vector_to_values(rxs, "exampleVector");

### View the results for the first source
  filterFun = function(node) {
    return(grepl("exampleVector_", node$name));
  simplify = FALSE
#> $exampleVector_a
#> [1] 1
#> $exampleVector_b
#> [1] 1
#> $exampleVector_c
#> [1] 0
#> $exampleVector_d
#> [1] 0