These function can be used to convert one or more parsed sources to HTML, or to convert all sources to tabbed sections in Markdown.

export_codes_to_txt(
  input,
  output = NULL,
  codeTree = "fullyMergedCodeTrees",
  codingScheme = "codes",
  regex = ".*",
  onlyChildrenOf = NULL,
  leavesOnly = TRUE,
  includePath = TRUE,
  preventOverwriting = rock::opts$get(preventOverwriting),
  encoding = rock::opts$get(encoding),
  silent = rock::opts$get(silent)
)

Arguments

input

An object of class rockParsedSource (as resulting from a call to parse_source) or of class rockParsedSources (as resulting from a call to parse_sources.

output

THe filename to write to.

codeTree

Codes from which code tree to export the codes. Valid options are fullyMergedCodeTrees, extendedDeductiveCodeTrees, deductiveCodeTrees, and inductiveCodeTrees.

codingScheme

With the ROCK, it's possible to use multiple coding scheme's in parallel. The ROCK default is called codes (using the double square brackets as code delimiters), but other delimiters can be used as well, and give a different name. Use codingScheme to specify which code tree you want to export, if you have multiple.

regex

An optional regular expression: only codes matching this regular expression will be selected.

onlyChildrenOf

A character vector of one or more regular expressions that specify codes within which to search. For example, if the code tree contains codes parent1 and parent2, and each have a number of child codes, and parent is passed as onlyChildrenOf, only the codes within parent are selected.

leavesOnly

Whether to only write the leaves (i.e. codes that don't have children) or all codes in the code tree.

includePath

Whether to only return the code itself (e.g. code) or also include the path to the root (e.g. code1>code2>code).

preventOverwriting

Whether to prevent overwriting of output files.

encoding

The encoding to use when writing the exported source(s).

silent

Whether to suppress messages.

Value

A character vector.

Examples

### Get path to example source examplePath <- system.file("extdata", package="rock"); ### Parse all example sources in that directory parsedExamples <- rock::parse_sources(examplePath); ### Show results of exporting the codes export_codes_to_txt(parsedExamples);
#> [1] "behavior_xl67k7w8j>intention_71vr5q3q>attitude_71vqm37n>attitude_instrumental_xl678lqgp" #> [2] "behavior_xl67k7w8j>intention_71vr5q3q>attitude_71vqm37n>attitude_experiential_xl678lqgn" #> [3] "behavior_xl67k7w8j>intention_71vr5q3q>perceivedBehavioralControl_71w8sfdk" #> [4] "behavior_xl67k7w8j>intention_71vr5q3q>perceivedNorm_71w98kk2" #> [5] "parentCode1>childCode1>grandchildCode1" #> [6] "parentCode1>childCode1>grandchildCode2" #> [7] "parentCode1>childCode1>grandchildCode3" #> [8] "parentCode1>childCode2" #> [9] "parentCode1>childCode3" #> [10] "pets>cats>siamese" #> [11] "furniture>tables" #> [12] "furniture>chairs" #> [13] "furniture>oaken_chests" #> [14] "source>internet" #> [15] "source>books" #> [16] "source>people" #> [17] "attitude>exp_attitude>exp_att_expect" #> [18] "attitude>exp_attitude>exp_att_eval" #> [19] "attitude>instr_att>instr_att_expect" #> [20] "attitude>instr_att>instr_att_eval" #> [21] "parentCode2>childCode4>grandchildCode4" #> [22] "parentCode2>childCode4>grandchildCode5" #> [23] "parentCode2>childCode4>grandchildCode6" #> [24] "parentCode2>childCode5>grandchildCode7" #> [25] "someOtherCode" #> [26] "att_ins_eval" #> [27] "chairs" #> [28] "inductFather>inducChild3" #> [29] "inductFather>inducChild4" #> [30] "inductFather>inducChild5" #> [31] "inductMother>inducChild1" #> [32] "inductMother>inducChild2" #> [33] "internet" #> [34] "oaken_chests" #> [35] "people" #> [36] "tables" #> [37] "Topic1" #> [38] "Topic2" #> [39] "bla>subbla>bla2" #> [40] "bla>subbla>bla3" #> [41] "bla>subbla2" #> [42] "flups" #> [43] "property>hairy" #> [44] "relationships>love"
### Only show select a narrow set of codes export_codes_to_txt(parsedExamples, leavesOnly=TRUE, includePath=FALSE, onlyChildrenOf = "parentCode2", regex="5|6");
#> [1] "grandchildCode5" "grandchildCode6"