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 data.frame
find_comments(x, ...)

# S3 method for character
find_comments(x, ...)

# S3 method for logical
find_comments(x, ...)

Arguments

x

a data frame or character vector

...

not used

Value

A logical vector

Details

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 ..

Examples

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