R/helpers.R

Defines functions text_between_curly_brackets na_replace capitalize

capitalize <- function(string) {
  paste0(substr(string, 1, 1),
         tolower(substr(string, 2, nchar(string))))
}

na_replace <- function(df) {
  df[is.na(df)] <- ""
  return(df)
}

text_between_curly_brackets <- function(string) {
  min <- min(gregexpr("\\{", string)[[1]])
  max <- max(gregexpr("\\}", string)[[1]])
  content <- substring(string, min + 1, max - 1)
  return(content)
}

Try the bib2df package in your browser

Any scripts or data that you put into this service are public.

bib2df documentation built on June 22, 2024, 11:11 a.m.