Skip to content

Commit

Permalink
Flesh out reference documentation for the parse_qcodes function
Browse files Browse the repository at this point in the history
Adds a bit more context to the parse_qcodes function documentation. We need more
complete documentation in order to publish to CRAN.

The updated documentation talks a little bit more about how this function works,
and provides a couple of examples.

I moved the majority of the description into the details. This makes the
description a bit more consise while preserving the details in the appopriately
named details section.

See: #209
  • Loading branch information
changecase committed Jun 21, 2021
1 parent 9344999 commit 9112a9e
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 17 deletions.
40 changes: 32 additions & 8 deletions R/parse_qcodes.R
Original file line number Diff line number Diff line change
@@ -1,17 +1,41 @@
#' Parse coded text
#'
#' Take a text document containing coded text of the form:
#' "stuff to ignore (QCODE) coded text we care about (/QCODE){#qcode} more stuff to ignore"
#' and turn it into a dataframe with one row per coded item, of the form:
#' docid,qcode,text
#' Take a data frame of coded text documents and return a data frame of the
#' codes captured within.
#'
#' Replaces newline characters with an HTML "br" in the captured text
#' returns an empty dataframe (no rows) if no qcodes were found.
#' This function takes a text document containing coded text of the form:
#' \preformatted{"stuff to ignore (QCODE) coded text we care about (/QCODE){#my_code}
#' more stuff to ignore"} and turns it into a data frame with one row per coded
#' item, of the form: \code{docid,qcode,text}
#'
#' @param x A data frame containing the text to be coded; requires columns "doc_id" and "document_text"
#' \code{parse_qcodes} assumes that it is being passed a data frame, the
#' \code{\link{parse_one_document}} function is called to do the heavy lifting
#' extracting the coded text from the \code{document_text} column.
#'
#' Newline characters are replaced with an HTML \code{<br>} in the captured text.
#'
#' If no valid qcodes are found, \code{parse_qcodes} returns an empty data frame
#' (no rows).
#'
#' @param x A data frame containing the text to be coded; requires columns
#' "doc_id" and "document_text"
#' @param ... Other parameters optionally passed in
#' @return If the data frame contains coded text in the \code{document_text}
#' column, output will be a data frame with three columns: "doc",
#' "qcode", and "text".
#'
#' The "doc" column is the corresponding "doc_id" value from the input
#' data frame.
#'
#' "qcode" is the code that the captured text was marked up with.
#'
#' "text" is the text that was captured.
#' @examples
#' unlink("./_my_qcoder_project", recursive=TRUE)
#' parse_qcodes(my_documents)
#'
#' # Data frames can be piped into this function
#' my_documents %>%
#' parse_qcodes()
#' @export

parse_qcodes <- function(x, ...){
Expand Down
40 changes: 32 additions & 8 deletions man/parse_qcodes.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/qcode.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9112a9e

Please sign in to comment.