R/record_as_cited.R

Defines functions record_as_cited

Documented in record_as_cited

#' record as cited
#' 
#' adds a BibEntry object to the works cited list even if not cited 
#' with a call to citep/citet
#' @param entry a BibEntry object (or something that can be coerced to one, like bibentry)
#' @return Adds the object to the citation list, with a BibTex citation 
#' key that does not duplicate any that are already in the record.  
#' Invisibly returns the bibentry object.  
#' @export
record_as_cited <- function(entry){
  if(!is(entry, "BibEntry"))
    entry <- as.BibEntry(entry)

  hash <- check_unique(entry)

  if(entry_exists(hash)){
    entry <- get_matching_key(entry)

  } else { 
    entry <- get_unique_key(entry)
    update_biblio(hash, entry)
  }
  invisible(entry)
}

Try the knitcitations package in your browser

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

knitcitations documentation built on Jan. 13, 2021, 9:57 a.m.