R/format_table.R

Defines functions format_publication_table small_html title_html paper_html

Documented in format_publication_table

#' Format publication table
#'
#' @import dplyr
format_publication_table <- function(publi_table) {

  df <- publi_table %>%
    arrange(desc(year)) %>%
    transmute(
      Journal = paper_html(journal_title_iso),
      Title = title_html(title, pmid),
      Year = year,
      "Author rank" = sigaps_author_rank,
      "Journal rank" = paper_rank,
      Score = sigaps_score,
      Affiliation = small_html(affiliation)
    )

}

small_html <- function(text)
  paste0("<small>", text, "</small>")

title_html <- function(paper_title, pmid) {
  paste0(
    "<a href='https://www.ncbi.nlm.nih.gov/pubmed/", pmid, "'>",
    paper_title,"</a>"
    )
}

paper_html <- function(paper_abbr) {
  url <- paste0('https://www.ncbi.nlm.nih.gov/nlmcatalog?term="', paper_abbr, '"[Title+Abbreviation]')
  paste0("<a href='", url,"'>",paper_abbr,"</a>")
}
jomuller/rigaps documentation built on May 29, 2019, 12:39 p.m.