R/find_refs.R

Defines functions find_refs

Documented in find_refs

#' Find Refs
#'
#' This is a helper function for the `check_bibtex_file` function. It looks for
#' references in the bibtex file. This function should not be used on its own.
#'
#' @param file
#'
#' @return
#' @export
#'
#' @examples
#'
#'
find_refs <- function(file){
  lines <- readLines(file)
  lines_vec <- c()
  start = 1
  for(i in 1:length(lines)){
    if(lines[i] == "}"){
      end = i
      x <- paste(lines[start:end], collapse = "\n")
      start = i+2
      lines_vec <- c(lines_vec, x)
    }
  }
  return(lines_vec)
}
matthewwankiewicz/citationcheckR documentation built on Dec. 21, 2021, 3:47 p.m.