R/has_unclosed_brackets.R

Defines functions has_unclosed_brackets

Documented in has_unclosed_brackets

#' Logical for unclosed brackets
#' @export

has_unclosed_brackets <-
        function(strings) {
                output <- vector()
                for (string in strings) {

                        output_1 <- grepl("\\[", string)

                        if (output_1 == TRUE) {

                                output_2 <- grepl("\\]", string)

                                if (output_2 == TRUE) {
                                        output <- c(output, FALSE)
                                } else {
                                        output <- c(output, TRUE)
                                }
                        } else {
                                output_2 <- grepl("\\]", string)
                                if (output_2 == TRUE) {
                                        output <- c(output, TRUE)
                                } else {
                                        output <- c(output, FALSE)
                                }
                        }
                }
                return(output)
        }
meerapatelmd/centipede documentation built on Jan. 1, 2021, 9:27 a.m.