This function uses specific criteria for finding comment records that may not match up with your coding conventions. See details below as well as unit tests.
find_comments(x, ...)
# S3 method for class 'data.frame'
find_comments(x, ...)
# S3 method for class 'character'
find_comments(x, ...)
# S3 method for class 'logical'
find_comments(x, ...)
A logical vector
For the data frame method, comments are found in a column with name C
with type character
. If a C
column is found that is not character,
a warning is generated and no comments are found.
For the character method or when an appropriate C
column is found when
using the data frame method, a position or row is considered a comment
when it is either NA
or when it is equal to .
.
comment <- c(NA, "C", "C", NA, ".", NA, "Comment")
dv <- rnorm(length(comment))
df <- data.frame(C = comment , DV = dv, stringsAsFactors = FALSE)
find_comments(df)
#> [1] FALSE TRUE TRUE FALSE FALSE FALSE TRUE