Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add examples to functions #122

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions R/compare.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
#' @param include_references Should bibliographic detail be included in return?
#' @return dataframe with indicators of where a citation appears, with source/label/string as column
#' @examples
#' dedup_results <- dedup_citations(CiteSource::examplecitations, merge_citations = TRUE)
#' if (interactive()){
#' dedup_results <- dedup_citations(citations, merge_citations = TRUE)
#' unique_citations <- dedup_results$unique
#' count_unique(unique_citations)
#' count_unique(unique_citations)}

count_unique <- function(unique_data, include_references = FALSE) {
out <- unique_data %>%
Expand Down Expand Up @@ -38,14 +39,10 @@ count_unique <- function(unique_data, include_references = FALSE) {
#' @param include_references Should bibliographic detail be included in return?
#' @return dataframe with indicators of where a citation appears, with sources/labels/strings as columns
#' @examples
#' if (interactive()) {
#' # Load example data from the package
#' data("examplecitations", package = "CiteSource")
#'
#' # Deduplicate citations and compare sources
#' dedup_results <- dedup_citations(examplecitations, merge_citations = TRUE)
#' unique_citations <- dedup_results$unique
#' compare_sources(unique_citations, comp_type = "sources")
#' if (interactive()){
#' dedup_results <- dedup_citations(citations, merge_citations = TRUE)
#' unique_citations <- dedup_results$unique
#' compare_sources(unique_citations, comp_type = "sources")
#' }


Expand Down
2 changes: 1 addition & 1 deletion R/runShiny.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#' @param offer_install Should user be prompted to install required packages if they are missing?
#' @importFrom magrittr %>%
#' @export
#' @examples
#' @examples
#' if (interactive()) {
#' # To run the CiteSource Shiny app:
#' runShiny()
Expand Down
6 changes: 5 additions & 1 deletion R/tables.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@
#' @param 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.
#' @export

#' @examples
#' if (interactive()){
#' deduped_citations <- dedup_citations(citations)
#' record_table <- record_level_table(deduped_citations)
#' }
record_level_table <- function(citations, include = "sources", include_empty = TRUE, return = c("tibble", "DT"), indicator_presence = NULL, indicator_absence = NULL) {
if (!is.data.frame(citations) || nrow(citations) == 0) stop("Citations must be a tibble and cannot have 0 entries")

Expand Down
13 changes: 4 additions & 9 deletions man/compare_sources.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/count_unique.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions man/record_level_table.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.