parseText: Parse text in character vector into individual elements by...

View source: R/parseText.R

parseTextR Documentation

Parse text in character vector into individual elements by quotes and whitespace, keeping quoted text together in same element (with whitespace but without quotation marks)

Description

Function to parse text in character vector into individual elements by quotes and whitespace, keeping quoted text together in same element (with whitespace but without quotation marks).

Usage

parseText(
  strv,
  qt = "'",
  keepQuotes = FALSE,
  stripComments = TRUE,
  comment = "#",
  verbose = FALSE
)

Arguments

strv
  • character vector to parse

qt
  • the character indicating quotation (' or ")

keepQuotes
  • flag to keep the quotation marks in the output (does nothing)

stripComments
  • flag to remove comments prior to parsing

comment
  • character used to indicate the start of a comment

verbose
  • flag (T/F) to print diagnostic info

Details

Each element in the returned list is a character vector whose elements consist of

  1. quoted text blocks and 2) unquoted text elements split by white space in the order they occur in the element of the character vector.

Value

numbered list, with elements corresponding to the equivalent vector element in strv AFTER comments have been removed.


wStockhausen/wtsUtilities documentation built on March 16, 2024, 10:38 a.m.