Skip to contents

Creates a per-record table that shows which sources (and/or labels/strings) each item was found in.

Usage

record_level_table(
  citations,
  include = "sources",
  include_empty = TRUE,
  return = c("tibble", "DT"),
  indicator_presence = NULL,
  indicator_absence = NULL
)

Arguments

citations

A deduplicated tibble as returned by dedup_citations().

include

Which metadata should be included in the table? Defaults to 'sources', can be replaced or expanded with 'labels' and/or 'strings'

include_empty

Should records with empty metadata (e.g., no information on 'sources') be included in the table? Defaults to FALSE.

return

Either a tibble that can be exported, e.g. as a csv, or a DataTable (DT) that allows for interactive exploration. Note that the DataTable allows users to download a .csv file; in that file, presence and absence is always indicated as TRUE and FALSE to prevent issues with character encodings.

indicator_presence

How should it be indicated that a value is present in a source/label/string? Defaults to TRUE in tibbles and a tickmark in DT tables

indicator_absence

How should it be indicated that a value is not present in a source/label/string? Defaults to FALSE in tibbles and a cross in DT tables

Value

A tibble or DataTable containing the per-record table that shows which sources (and/or labels/strings) each item was found in.

Examples

# Load example data from the package
examplecitations_path <- system.file("extdata", "examplecitations.rds", package = "CiteSource")
examplecitations <- readRDS(examplecitations_path)

# Deduplicate citations and compare sources
unique_citations <- dedup_citations(examplecitations)
#> formatting data...
#> Warning: Search contains missing values for the record_id column. A record_id will be created using row numbers
#> identifying potential duplicates...
#> identified duplicates!
#> flagging potential pairs for manual dedup...
#> 165 citations loaded...
#> 67 duplicate citations removed...
#> 98 unique citations remaining!

unique_citations |> 
dplyr::filter(stringr::str_detect(cite_label, "final"))  |> 
record_level_table(return = "DT")