The Reproducible Open Coding Kit (ROCK) format is a format for open and transparent storage and analysis of qualitative data. In systematic reviews, you often want to extract an entity as raw text, so that you can apply a structured coding procedure to the raw text fragments without exposing the coders to other extracted information (to minimize bias). By exporting these entities to the ROCK format, the regular workflows used for qualitative research can be used, after which the coded sources can be imported back into metabefor and merged with the Rxs project.

  entityId = NULL,
  outputFile = NULL,
  rxsEntityId = metabefor::opts$get("rockInterfacing_rxsEntityId"),
  rxsSourceId = metabefor::opts$get("rockInterfacing_rxsSourceId")

  input = NULL,
  newEntityIds = "%s_%s",
  newEntityIdCodeFirst = FALSE,
  filenameRegex = NULL,
  recursive = TRUE,
  rxsSourceId = metabefor::opts$get("rockInterfacing_rxsSourceId"),
  rxsEntityId = metabefor::opts$get("rockInterfacing_rxsEntityId")



The Rxs object, either an Rxs project (as produced by rxs_parseExtractionScripts()) or a single Rxs extraction tree, to export from or merge into.


The identifier of the entity to create a source for.


Optionally, a file to write the source to. If no file is specified, the resulting character vector will be returned visibly (if an output file is specified, it will be returned invisibly).

rxsEntityId, rxsSourceId

The class instance identifiers to use in the ROCK source to identify instances of the 'entity' and 'source' classes. Note that source here refers to a source in the systematic review, i.e. an Rxs tree; not to be confused with a ROCK source (i.e. a plain text file with one or more data fragments to code).


The filename or path with files from which to import the ROCK sources.

newEntityIds, newEntityIdCodeFirst

To determine how the new entity identifiers are composed, newEntityIds s used. This has to be a base::sprintf fmt string containing exactly two occurrences of "%s". If newEntityIdCodeFirst is FALSE, the first %s is replaced by the the original entity identifier (stored using the rxsEntityId class instance identifier in the ROCK format), and the second by the code. If it is TRUE, this order is reversed.


Optionally, a regular expression: if not NULL, only files matching this regualr expression will be imported.


Whether to read directories recursively


The ROCK source as a character vector, invisibly, unless an outputFile is specified for metabefor::rxs_export_to_rock(). However, note that metabefor::rxs_import_from_rock() also modifies the Rxs object in place (based on the "pass by reference" logic used by data.tree).