R/cleanCode.R

Defines functions cleanCode

cleanCode <- function(x) {

  codeDelimiters <- rock::opts$get("codeDelimiters");
  inductiveCodingHierarchyMarker <-
    rock::opts$get("inductiveCodingHierarchyMarker");

  x <-
    gsub(
      escapeRegexCharacterClass(codeDelimiters[1]),
      "",
      x
    );

  x <-
    gsub(
      escapeRegexCharacterClass(codeDelimiters[2]),
      "",
      x
    );

  x <- trimws(x);

  x <-
    gsub(
      paste0("^", inductiveCodingHierarchyMarker),
      "",
      x
    );

  x <-
    gsub(
      paste0(inductiveCodingHierarchyMarker, "$"),
      "",
      x
    );

  return(x);

}

Try the rock package in your browser

Any scripts or data that you put into this service are public.

rock documentation built on Dec. 28, 2022, 1:55 a.m.