| Title: | Access the Database of the Milestones Project |
|---|---|
| Description: | This package provides a simple R interface to the database tables used in the Milestones Project, <https://datavis.ca/milestones/>, reflecting the history of data visualization, as used in datavis.ca/milestones. Functions are provided to retrieve the tables of milestones events, authors, references, etc. |
| Authors: | Michael Friendly [aut, cre] (ORCID: <https://orcid.org/0000-0002-3237-0941>), Matthew Dubins [aut] |
| Maintainer: | Michael Friendly <[email protected]> |
| License: | GPL-3 |
| Version: | 0.4.0 |
| Built: | 2026-11-29 21:22:49 UTC |
| Source: | https://github.com/friendly/milestoneR |
Retrieve the aspect table containing aspect classifications that indicate
the role milestone events played in the history of data visualization.
aspect()aspect()
A data frame. See aspect() for details.
The aspect classification indicates the role an event played in the history
of data visualization. Use milestone2aspect() to link milestones
to their aspects.
A data frame with 4 rows and 2 variables:
aspect id, a numeric vector
aspect name (Cartography, Statistics & Graphics, Technology, Other), a character vector
https://datavis.ca/milestones/
## Not run: # Get all aspects aspect() ## End(Not run)## Not run: # Get all aspects aspect() ## End(Not run)
Retrieve the author table containing information about authors associated
with milestone events in the history of data visualization.
authors()authors()
A data frame. See authors() for details.
A data frame with 290 rows and 15 variables:
author id, a numeric vector
name prefix, a character vector
given names, a character vector
last name, a character vector
name suffix, a character vector
years lived, a character vector
birth date, a Date vector
place of birth, a character vector
latitude of birthplace, a numeric vector
longitude of birthplace, a numeric vector
death date, a Date vector
place of death, a character vector
latitude of deathplace, a numeric vector
longitude of deathplace, a numeric vector
notes about this author, a character vector
https://datavis.ca/milestones/
# Get all authors aut <- authors() # Authors with a known birthplace born <- subset(aut, !is.na(birthplace), select = c(givennames, lname, lived, birthplace)) head(born)# Get all authors aut <- authors() # Authors with a known birthplace born <- subset(aut, !is.na(birthplace), select = c(givennames, lname, lived, birthplace)) head(born)
The idea of an "epoch" is to provide a grouping of years of into time periods that can be
characterized by some theme.
define_epoch() creates a data structure defining historical epochs or use in
timeline visualizations, or analysis of milestones items.
It returns a data frame with epoch boundaries, labels,
and calculated midpoints.
define_epochs( breaks = NULL, labels = NULL, descriptions = NULL, style = c("default", "custom"), extend = NULL ) ## S3 method for class 'milestone_epochs' print(x, ...)define_epochs( breaks = NULL, labels = NULL, descriptions = NULL, style = c("default", "custom"), extend = NULL ) ## S3 method for class 'milestone_epochs' print(x, ...)
breaks |
Numeric vector of boundary years (for custom epochs). Must be sorted in ascending order. |
labels |
Character vector of epoch names. Length must be one less than
length of |
descriptions |
Optional character vector of longer descriptions for each epoch. |
style |
Character. Either "default" to use predefined epochs, or "custom"
to use provided |
extend |
Character or logical. How to extend the default epochs:
Only used when |
x |
An object of class |
... |
Additional arguments (currently ignored). |
The functions epoch_boundaries() and get_epoch() provide tools for working with epochs
in relation to milestones events.
The default epochs are based on the period classification described in Friendly et al. (2015)
for use in producing timeline with interpretable labels. The extend argument allows these
defaults to be extended to earlier or later periods.
1500-1600: Early maps & diagrams
1600-1700: Measurement & theory
1700-1800: New graphic forms
1800-1850: Modern age
1850-1900: Golden Age
1900-1950: Dark age
1950-1975: Re-birth
1975-2000: Hi-Dim Vis
You can create your own time epochs using style = "custom" and providing breaks and labels
The returned data frame has class c("milestone_epochs", "data.frame")
and contains columns:
epoch_id: Sequential identifier (1, 2, 3, ...)
start: Start year of epoch
end: End year of epoch
label: Short display name
midpoint: (start + end) / 2, useful for label positioning
description: Optional longer description
A data frame of class c("milestone_epochs", "data.frame") with
one row per epoch.
Invisibly returns the input object.
Friendly, M., Sigal, M. & Harnanansingh, D. (2015). "The Milestones Project: A Database for the History of Data Visualization." In Kimball, M. & Kostelnick, C. (Eds.) Visible Numbers: The Historyof Data Visualization, Chapter 10.
epoch_boundaries(), get_epoch()
# Get default epochs epochs <- define_epochs() print(epochs) # print it just as a plain data.frame as.data.frame(epochs) # Extend with Prehistory and Digital Age extended <- define_epochs(extend = TRUE) print(extended) # Extend only before with_prehistory <- define_epochs(extend = "before") # Define custom epochs (4 breaks creates 3 intervals) my_epochs <- define_epochs( breaks = c(1600, 1750, 1900, 2000), labels = c("Early Modern", "Enlightenment", "Industrial"), style = "custom" ) # Get epoch boundaries for plotting vertical lines boundaries <- epoch_boundaries(epochs) # ---- Relating milestone items to epochs ---- # Load milestone data ms <- milestone() # Attach epoch labels to each milestone ms$epoch <- get_epoch(ms$date_from_numeric, extended) # Create a frequency table of milestones by epoch table(ms$epoch, useNA = "ifany") # Or as a data frame with counts as.data.frame(table(epoch = ms$epoch)) # Get summary statistics for each epoch: count, min year, max year # (in epoch order, not alphabetical) by_epoch <- split(ms$date_from_numeric, factor(ms$epoch, levels = extended$label)) data.frame(n = lengths(by_epoch), min_year = sapply(by_epoch, min), max_year = sapply(by_epoch, max))# Get default epochs epochs <- define_epochs() print(epochs) # print it just as a plain data.frame as.data.frame(epochs) # Extend with Prehistory and Digital Age extended <- define_epochs(extend = TRUE) print(extended) # Extend only before with_prehistory <- define_epochs(extend = "before") # Define custom epochs (4 breaks creates 3 intervals) my_epochs <- define_epochs( breaks = c(1600, 1750, 1900, 2000), labels = c("Early Modern", "Enlightenment", "Industrial"), style = "custom" ) # Get epoch boundaries for plotting vertical lines boundaries <- epoch_boundaries(epochs) # ---- Relating milestone items to epochs ---- # Load milestone data ms <- milestone() # Attach epoch labels to each milestone ms$epoch <- get_epoch(ms$date_from_numeric, extended) # Create a frequency table of milestones by epoch table(ms$epoch, useNA = "ifany") # Or as a data frame with counts as.data.frame(table(epoch = ms$epoch)) # Get summary statistics for each epoch: count, min year, max year # (in epoch order, not alphabetical) by_epoch <- split(ms$date_from_numeric, factor(ms$epoch, levels = extended$label)) data.frame(n = lengths(by_epoch), min_year = sapply(by_epoch, min), max_year = sapply(by_epoch, max))
Extracts the unique boundary years from an epoch definition. Useful for adding vertical reference lines at epoch transitions.
epoch_boundaries(epochs)epoch_boundaries(epochs)
epochs |
An object of class |
A numeric vector of unique, sorted boundary years.
epochs <- define_epochs() boundaries <- epoch_boundaries(epochs) print(boundaries)epochs <- define_epochs() boundaries <- epoch_boundaries(epochs) print(boundaries)
Writes the Milestones Project data to a folder of plain-text YAML files: one file per
milestone, plus shared files for authors, references and the controlled vocabularies
(aspects, subjects, keywords). The files are meant to be the editable, version-controlled
source of the data. read_milestones_yaml() reads them back into the package's tables.
export_milestones_yaml(dir, overwrite = FALSE, quiet = FALSE)export_milestones_yaml(dir, overwrite = FALSE, quiet = FALSE)
dir |
Folder to write into. It is created if needed. |
overwrite |
Logical. If |
quiet |
Logical. If |
The layout is:
<dir>/
milestones/<slug>.yaml one per milestone, e.g. 1786Playfair.yaml (characters other
than letters, digits, `_`, `.`, `-` are dropped from the name)
authors.yaml all authors, keyed by "Family, Given"
references.yaml all references, keyed by BibTeX key
vocabulary.yaml aspect, subject and keyword names, with their ids
Within a milestone file, authors, references, keywords, aspects and subjects are given by
name or key, not by integer id. Database ids (mid, aid, rid) are kept as id:
fields so the tables can be rebuilt exactly. New items can leave them out.
Some cleaning is applied on export:
Text fields have \r\n converted to \n and trailing white space removed. Values that
are then empty become missing and are omitted.
Author family names come from the cleaned lnames column (no HTML entities).
Duplicate rows in the link tables are dropped, as are links to authors not in the
author table (in the database, aid 1 is "Unknown"). A milestone without authors:
has unknown author(s).
A duplicated bibtexkey gets the suffix -<rid> to make the key unique, and the
original value is kept in a bibtexkey field.
add_date and modified_date (m/d/yy in the database) are written as ISO dates.
The MySQL "zero date" 0000-00-00 is treated as missing.
Image URLs under http://datavis.ca/milestones/uploads/images/ are written as a file:
path relative to that folder.
The paths of the files written, invisibly.
## Not run: dir <- file.path(tempdir(), "milestones-yaml") export_milestones_yaml(dir) list.files(dir, recursive = TRUE)[1:5] cat(readLines(file.path(dir, "milestones", "1786Playfair.yaml")), sep = "\n") ## End(Not run)## Not run: dir <- file.path(tempdir(), "milestones-yaml") export_milestones_yaml(dir) list.files(dir, recursive = TRUE)[1:5] cat(readLines(file.path(dir, "milestones", "1786Playfair.yaml")), sep = "\n") ## End(Not run)
Determines which epoch(s) one or more years belong to.
get_epoch(year, epochs, label = TRUE)get_epoch(year, epochs, label = TRUE)
year |
Numeric vector of years to classify. |
epochs |
An object of class |
label |
Logical. If |
A character vector (if label = TRUE) or integer vector
(if label = FALSE) indicating which epoch each year belongs to.
Years outside the epoch range return NA.
define_epochs(), epoch_boundaries()
epochs <- define_epochs() # Which epoch is 1850? get_epoch(1850, epochs) # Multiple years get_epoch(c(1650, 1850, 1975), epochs) # Get IDs instead of labels get_epoch(c(1650, 1850), epochs, label = FALSE) # Attach epochs to all milestones for analysis ms <- milestone() extended <- define_epochs(extend = "before") ms$epoch <- get_epoch(ms$date_from_numeric, extended) # Frequency table of milestones by epoch table(ms$epoch) # Cross-tabulate by epoch and subject ms_subjects <- milestone2subject() ms_with_subject <- merge(ms, ms_subjects, by = "mid") table(ms_with_subject$epoch, ms_with_subject$subject)epochs <- define_epochs() # Which epoch is 1850? get_epoch(1850, epochs) # Multiple years get_epoch(c(1650, 1850, 1975), epochs) # Get IDs instead of labels get_epoch(c(1650, 1850), epochs, label = FALSE) # Attach epochs to all milestones for analysis ms <- milestone() extended <- define_epochs(extend = "before") ms$epoch <- get_epoch(ms$date_from_numeric, extended) # Frequency table of milestones by epoch table(ms$epoch) # Cross-tabulate by epoch and subject ms_subjects <- milestone2subject() ms_with_subject <- merge(ms, ms_subjects, by = "mid") table(ms_with_subject$epoch, ms_with_subject$subject)
Retrieves aspect information for one or more milestones from the milestone2aspect table, which already includes aspect names.
get_milestone_aspects(mid)get_milestone_aspects(mid)
mid |
A numeric vector of milestone IDs |
A data frame with columns mid, asid, and aspect
## Not run: # Get aspects for a single milestone get_milestone_aspects(53) # Get aspects for multiple milestones get_milestone_aspects(c(53, 54, 55)) ## End(Not run)## Not run: # Get aspects for a single milestone get_milestone_aspects(53) # Get aspects for multiple milestones get_milestone_aspects(c(53, 54, 55)) ## End(Not run)
Retrieves author information for one or more milestones by joining the milestone2author linking table with the author table.
get_milestone_authors(mid)get_milestone_authors(mid)
mid |
A numeric vector of milestone IDs |
A data frame with columns from both milestone2author and author tables, including mid, aid, and all author fields (prefix, givennames, lname, etc.)
## Not run: # Get authors for a single milestone get_milestone_authors(53) # Get authors for multiple milestones get_milestone_authors(c(53, 54, 55)) ## End(Not run)## Not run: # Get authors for a single milestone get_milestone_authors(53) # Get authors for multiple milestones get_milestone_authors(c(53, 54, 55)) ## End(Not run)
Retrieves keyword information for one or more milestones from the milestone2keyword table, which already includes keyword names.
get_milestone_keywords(mid)get_milestone_keywords(mid)
mid |
A numeric vector of milestone IDs |
A data frame with columns mid, kid, and keyword
## Not run: # Get keywords for a single milestone get_milestone_keywords(53) # Get keywords for multiple milestones get_milestone_keywords(c(53, 54, 55)) ## End(Not run)## Not run: # Get keywords for a single milestone get_milestone_keywords(53) # Get keywords for multiple milestones get_milestone_keywords(c(53, 54, 55)) ## End(Not run)
Retrieves media item information for one or more milestones from the mediaitem table, which contains the mid field directly (no linking table needed).
get_milestone_media(mid)get_milestone_media(mid)
mid |
A numeric vector of milestone IDs |
A data frame with columns from the mediaitem table, including mid, miid, type, url, title, caption, source, and type2
## Not run: # Get media items for a single milestone get_milestone_media(53) # Get media items for multiple milestones get_milestone_media(c(53, 54, 55)) ## End(Not run)## Not run: # Get media items for a single milestone get_milestone_media(53) # Get media items for multiple milestones get_milestone_media(c(53, 54, 55)) ## End(Not run)
Retrieves reference information for one or more milestones by joining the milestone2reference linking table with the reference table.
get_milestone_references(mid)get_milestone_references(mid)
mid |
A numeric vector of milestone IDs |
A data frame with columns from both milestone2reference and reference tables, including mid, rid, and all reference fields (author, title, year, etc.)
## Not run: # Get references for a single milestone get_milestone_references(53) # Get references for multiple milestones get_milestone_references(c(53, 54, 55)) ## End(Not run)## Not run: # Get references for a single milestone get_milestone_references(53) # Get references for multiple milestones get_milestone_references(c(53, 54, 55)) ## End(Not run)
Retrieves subject information for one or more milestones from the milestone2subject table, which already includes subject names.
get_milestone_subjects(mid)get_milestone_subjects(mid)
mid |
A numeric vector of milestone IDs |
A data frame with columns mid, sid, and subject
## Not run: # Get subjects for a single milestone get_milestone_subjects(53) # Get subjects for multiple milestones get_milestone_subjects(c(53, 54, 55)) ## End(Not run)## Not run: # Get subjects for a single milestone get_milestone_subjects(53) # Get subjects for multiple milestones get_milestone_subjects(c(53, 54, 55)) ## End(Not run)
Retrieve the keyword table containing keywords or terms attached to
milestone items as a freeform classification.
keyword()keyword()
A data frame. See keyword() for details.
This is a freeform classification listing keywords or terms attached to
milestone items. Use milestone2keyword() to link milestones
to their keywords.
A data frame with 335 rows and 2 variables:
keyword id, a numeric vector
keyword name, a character vector
https://datavis.ca/milestones/
# Get all keywords kw <- keyword() # Find keywords containing "chart" subset(kw, grepl("chart", name, ignore.case = TRUE))# Get all keywords kw <- keyword() # Find keywords containing "chart" subset(kw, grepl("chart", name, ignore.case = TRUE))
mediaitem table from the milestones databaseThe mediaitem table gives each link or image used in displaying the milestones items
A dataset containing links and images used in displaying milestone items.
mediaitem() data(mediaitem)mediaitem() data(mediaitem)
A data frame with 600 rows and 8 variables:
mediaitem id, a numeric vector
type (link or image), a character vector
URL to the media item, a character vector
title or caption, a character vector
caption text, a character vector
source of the media, a character vector
milestone id to which this is attached, a numeric vector
secondary type classification, a character vector
The fields in the mediaitem table are:
miidmediaitem id, a numeric vector
typetype, a character vector, with values link, image
urlURL to reference this item in the milestones application
titlea character vector
captiona character vector
sourcea character vector
midmilestones id to which this is attached, a numeric vector
For type=="link", these give a standard HTML reference in the url field.
For type=="image", the url field references the image in the milestones website.
Returns a tibble of the mediaitem table
https://datavis.ca/milestones/
Retrieve the milestone table containing milestone events in the history of
data visualization. This is the primary table in the database. Other tables
are linked to it via the mid key.
milestone()milestone()
A data frame. See milestone() for details.
A data frame with 297 rows and 14 variables:
milestone id, a numeric vector
title slug, a character vector
numeric start date, a numeric vector
start date text, a character vector
numeric end date, a numeric vector
end date text, a character vector
tag line, a character vector
description of the milestone, a character vector
location, a character vector
date added to database, a character vector
date last modified, a character vector
publication status, a character vector
notes, a character vector
extra information, a character vector
https://datavis.ca/milestones/
# Get all milestones m <- milestone() # Filter by date: BC milestones subset(m, date_from_numeric < 0, select = c(slug, date_from, tag))# Get all milestones m <- milestone() # Filter by date: BC milestones subset(m, date_from_numeric < 0, select = c(slug, date_from, tag))
milestone2aspect table from the milestones databaseThe milestone2aspect table links milestones to their aspect classifications.
milestone2aspect()milestone2aspect()
A data frame. See milestone2aspect() for details.
The fields in the milestone2aspect table are:
midmilestone id, a numeric vector
asidaspect id, a numeric vector
aspectaspect name, a character vector
This table links milestones to aspects. The aspect field is included
for convenience (joined from the aspect() table).
Returns a tibble of the milestone2aspect table
## Not run: # Get milestone-aspect links m2a <- milestone2aspect() ## End(Not run)## Not run: # Get milestone-aspect links m2a <- milestone2aspect() ## End(Not run)
milestone2author table from the milestones databaseThe milestone2author table links milestones to their authors.
milestone2author()milestone2author()
A data frame. See milestone2author() for details.
The fields in the milestone2author table are:
midmilestone id, a numeric vector
aidauthor id, a numeric vector
This table links milestones to authors. Use with authors()
to get author information.
Returns a tibble of the milestone2author table
## Not run: # Get milestone-author links m2a <- milestone2author() ## End(Not run)## Not run: # Get milestone-author links m2a <- milestone2author() ## End(Not run)
milestone2keyword table from the milestones databaseThe milestone2keyword table links milestones to their keywords.
milestone2keyword()milestone2keyword()
A data frame. See milestone2keyword() for details.
The fields in the milestone2keyword table are:
midmilestone id, a numeric vector
kidkeyword id, a numeric vector
keywordkeyword name, a character vector
This table links milestones to keywords. The keyword field is included
for convenience (joined from the keyword() table).
Returns a tibble of the milestone2keyword table
## Not run: # Get milestone-keyword links m2k <- milestone2keyword() ## End(Not run)## Not run: # Get milestone-keyword links m2k <- milestone2keyword() ## End(Not run)
milestone2reference table from the milestones databaseThe milestone2reference table links milestones to their references.
milestone2reference()milestone2reference()
A data frame. See milestone2reference() for details.
The fields in the milestone2reference table are:
midmilestone id, a numeric vector
ridreference id, a numeric vector
This table links milestones to references. Use with reference()
to get reference information.
Returns a tibble of the milestone2reference table
## Not run: # Get milestone-reference links m2r <- milestone2reference() ## End(Not run)## Not run: # Get milestone-reference links m2r <- milestone2reference() ## End(Not run)
milestone2subject table from the milestones databaseThe milestone2subject table links milestones to their subject classifications.
milestone2subject()milestone2subject()
A data frame. See milestone2subject() for details.
The fields in the milestone2subject table are:
midmilestone id, a numeric vector
sidsubject id, a numeric vector
subjectsubject name, a character vector
This table links milestones to subjects. The subject field is included
for convenience (joined from the subject() table).
Returns a tibble of the milestone2subject table
## Not run: # Get milestone-subject links m2s <- milestone2subject() ## End(Not run)## Not run: # Get milestone-subject links m2s <- milestone2subject() ## End(Not run)
Format and print author entries from the milestones database as text, HTML, or markdown.
print_author(aut, result = c("text", "html", "md", "markdown"))print_author(aut, result = c("text", "html", "md", "markdown"))
aut |
A data frame from the |
result |
Output format: "text" for plain text (default), "html" for HTML formatted output, or "md"/"markdown" for markdown format |
The function formats author information including name, birth/death places and dates, and notes. Missing values are handled gracefully.
If multiple authors are provided (either as multiple rows or multiple IDs), each author is printed on a separate line with a blank line between them.
A character vector with the formatted author entries (invisibly). The formatted entries are also printed to the console.
## Not run: # Get authors and print the first one aut <- authors() print_author(aut[1, ]) # Print multiple authors print_author(aut[1:3, ]) # Print as HTML print_author(aut[1, ], result = "html") # Print as markdown print_author(aut[1, ], result = "md") # Look up by author ID print_author(2) # Look up multiple IDs print_author(c(2, 3, 4)) ## End(Not run)## Not run: # Get authors and print the first one aut <- authors() print_author(aut[1, ]) # Print multiple authors print_author(aut[1:3, ]) # Print as HTML print_author(aut[1, ], result = "html") # Print as markdown print_author(aut[1, ], result = "md") # Look up by author ID print_author(2) # Look up multiple IDs print_author(c(2, 3, 4)) ## End(Not run)
Format and print milestone entries from the milestones database as text, HTML, markdown, or enhanced CLI output, including all associated information (authors, references, keywords, subjects, aspects, media).
print_milestone( ms, result = c("text", "html", "md", "markdown", "cli"), include = c("authors", "keywords", "subjects", "aspects", "media", "references"), show_images = TRUE )print_milestone( ms, result = c("text", "html", "md", "markdown", "cli"), include = c("authors", "keywords", "subjects", "aspects", "media", "references"), show_images = TRUE )
ms |
A data frame from the |
result |
Output format: "text" for plain text (default), "html" for HTML formatted output, "md"/"markdown" for markdown format, or "cli" for enhanced console output with clickable links |
include |
Character vector specifying which sections to include. Options: "authors", "keywords", "subjects", "aspects", "media", "references". Default is all sections. |
show_images |
Logical; if TRUE, show image information in output. Default is TRUE. For text format, shows filenames only. |
The function formats milestones following the structure of the datavis.ca/milestones website, including header information (date, authors, tag), description, and optional sections for keywords, subjects, aspects, media items, and references.
If multiple milestones are provided (either as multiple rows or multiple IDs), each milestone is printed separately with a blank line (or visual separator for CLI).
The "cli" format uses the cli package to provide enhanced console output with
clickable hyperlinks, better visual structure, and improved formatting.
For "text", "html", and "md" formats: a character vector with the formatted milestone entries (invisibly). For "cli" format: NULL (invisibly). The formatted entries are printed to the console in all cases.
## Not run: # Get milestones and print one ms <- milestone() print_milestone(ms[1, ]) # Print by milestone ID print_milestone(53) # Print multiple milestones print_milestone(c(53, 54, 55)) # Print as HTML print_milestone(53, result = "html") # Print as markdown print_milestone(53, result = "md") # Print with enhanced CLI formatting (clickable links) print_milestone(53, result = "cli") # Print with only selected sections print_milestone(53, include = c("authors", "references")) ## End(Not run)## Not run: # Get milestones and print one ms <- milestone() print_milestone(ms[1, ]) # Print by milestone ID print_milestone(53) # Print multiple milestones print_milestone(c(53, 54, 55)) # Print as HTML print_milestone(53, result = "html") # Print as markdown print_milestone(53, result = "md") # Print with enhanced CLI formatting (clickable links) print_milestone(53, result = "cli") # Print with only selected sections print_milestone(53, include = c("authors", "references")) ## End(Not run)
Format and print milestone entries from the milestones database using the
cli package for enhanced console output with clickable links, better
formatting, and visual structure.
print_milestone_cli( ms, include = c("authors", "keywords", "subjects", "aspects", "media", "references"), show_images = TRUE )print_milestone_cli( ms, include = c("authors", "keywords", "subjects", "aspects", "media", "references"), show_images = TRUE )
ms |
A data frame from the |
include |
Character vector specifying which sections to include. Options: "authors", "keywords", "subjects", "aspects", "media", "references". Default is all sections. |
show_images |
Logical; if TRUE, show image information in output. Default is TRUE. |
This is a convenience wrapper around print_milestone() with result = "cli".
You can also call print_milestone(ms, result = "cli") directly.
This function uses the cli package to create enhanced console output with:
Clickable hyperlinks for media items and references
Better visual structure with headers and lists
Color and formatting for improved readability
If multiple milestones are provided (either as multiple rows or multiple IDs), each milestone is printed separately with visual separation.
NULL (invisibly). The formatted milestone is printed to the console using cli functions.
print_milestone() for the main print function with multiple output formats
## Not run: # Print a single milestone print_milestone_cli(53) # Print multiple milestones print_milestone_cli(c(53, 54, 55)) # Print with only selected sections print_milestone_cli(53, include = c("authors", "references")) # Equivalent using print_milestone directly print_milestone(53, result = "cli") ## End(Not run)## Not run: # Print a single milestone print_milestone_cli(53) # Print multiple milestones print_milestone_cli(c(53, 54, 55)) # Print with only selected sections print_milestone_cli(53, include = c("authors", "references")) # Equivalent using print_milestone directly print_milestone(53, result = "cli") ## End(Not run)
Format and print reference entries from the milestones database as text, HTML, or BibTeX.
print_reference( ref, result = c("text", "html", "md", "markdown", "bibtex"), bibtex = FALSE )print_reference( ref, result = c("text", "html", "md", "markdown", "bibtex"), bibtex = FALSE )
ref |
A data frame from the |
result |
Output format: "text" for plain text citation (default), "html" for HTML formatted citation, "md" or "markdown" for markdown format, or "bibtex" for BibTeX entry |
bibtex |
Logical; if TRUE, output as BibTeX entry (overrides |
The function formats references according to the reference type (article, book,
incollection, inproceedings). When bibtex = TRUE, it generates a proper
BibTeX entry using the bibtexkey field.
If multiple references are provided (either as multiple rows or multiple IDs), each reference is printed on a separate line with a blank line between them.
A character vector with the formatted references (invisibly). The formatted references are also printed to the console.
## Not run: # Get references and print the first one refs <- reference() print_reference(refs[1, ]) # Print multiple references print_reference(refs[1:3, ]) # Print as HTML print_reference(refs[1, ], result = "html") # Print as markdown print_reference(refs[1, ], result = "md") # Print as BibTeX print_reference(refs[1, ], bibtex = TRUE) # Look up by reference ID print_reference(261) # Look up multiple IDs print_reference(c(261, 262, 263)) ## End(Not run)## Not run: # Get references and print the first one refs <- reference() print_reference(refs[1, ]) # Print multiple references print_reference(refs[1:3, ]) # Print as HTML print_reference(refs[1, ], result = "html") # Print as markdown print_reference(refs[1, ], result = "md") # Print as BibTeX print_reference(refs[1, ], bibtex = TRUE) # Look up by reference ID print_reference(261) # Look up multiple IDs print_reference(c(261, 262, 263)) ## End(Not run)
Reads a folder written by export_milestones_yaml() (and possibly edited since) and
rebuilds the Milestones tables: milestone, author, reference, mediaitem,
keyword, aspect, subject and the milestone2* link tables. They have the same
columns as the datasets in this package.
read_milestones_yaml(dir)read_milestones_yaml(dir)
dir |
Folder containing |
Authors, references, keywords, aspects and subjects named in a milestone file must exist
in authors.yaml, references.yaml and vocabulary.yaml. Every problem found is
reported in one error message. Milestones, authors or references without an id: get
the next free id. Media item ids (miid) are assigned in order, so they are not stable
across edits.
A named list of data frames.
## Not run: dir <- file.path(tempdir(), "milestones-yaml") export_milestones_yaml(dir, overwrite = TRUE) tabs <- read_milestones_yaml(dir) names(tabs) head(tabs$milestone) ## End(Not run)## Not run: dir <- file.path(tempdir(), "milestones-yaml") export_milestones_yaml(dir, overwrite = TRUE) tabs <- read_milestones_yaml(dir) names(tabs) head(tabs$milestone) ## End(Not run)
reference table from the milestones databaseThe reference table gives the references associated with milestones items
A dataset containing bibliographic references associated with milestone events.
reference() data(reference)reference() data(reference)
A data frame with 352 rows and 17 variables:
reference id, a numeric vector
reference type (article, book, incollection), a factor
author names, a character vector
title of publication, a character vector
journal name (for articles), a character vector
month of publication, a character vector
year of publication, a character vector
volume number, a character vector
issue number, a character vector
page numbers, a character vector
publisher name, a character vector
publisher address, a character vector
editor names, a character vector
book title (for incollection), a character vector
BibTeX key, a character vector
abstract, a character vector
notes, a character vector
The fields in the reference table are:
ridreference id, a numeric vector
typereference type, a factor with levels article book incollection
authorauthor, a character vector
titletitle of publication, a character vector
journaljournal name, for an article, character vector
monthmonth name, a character vector
yeara numeric vector
volumea character vector
numbera character vector
pagesa character vector
publishera character vector
addressa character vector
editora character vector
booktitlea character vector
bibtexkeyBibTeX key used in the source .bib files, a character vector
abstracta character vector
notea character vector
In the note field, Loc{} refers to a library catalog identifier, e.g, Loc{BL: IA 3Q024}
TODO: need a function to turn these back to BibTeX
Returns a tibble of the reference table
https://datavis.ca/milestones/
Search for milestones associated with authors whose names match a pattern.
search_authors( pattern, name_fields = c("givennames", "lname"), ignore.case = TRUE, output = c("mid", "print", "data"), ... )search_authors( pattern, name_fields = c("givennames", "lname"), ignore.case = TRUE, output = c("mid", "print", "data"), ... )
pattern |
Character string or regular expression to match against author names |
name_fields |
Character vector specifying which name fields to search. Options: "givennames", "lname" (last name), "prefix", "suffix". Default is c("givennames", "lname"). |
ignore.case |
Logical; if TRUE (default), case is ignored during matching |
output |
Output format: "mid" returns milestone IDs (default), "print" prints formatted milestones, "data" returns milestone data frame |
... |
Additional arguments passed to |
This function searches author names and returns milestones associated with matching authors. The search is performed across specified name fields, and a milestone is returned if ANY associated author matches.
Depends on output parameter (see search_milestones())
## Not run: # Find milestones by Halley search_authors("Halley") # Find milestones by authors with "John" in their name search_authors("John") # Search only last names search_authors("Playfair", name_fields = "lname") # Print formatted results search_authors("Nightingale", output = "print") ## End(Not run)## Not run: # Find milestones by Halley search_authors("Halley") # Find milestones by authors with "John" in their name search_authors("John") # Search only last names search_authors("Playfair", name_fields = "lname") # Print formatted results search_authors("Nightingale", output = "print") ## End(Not run)
Search for milestones that have been tagged with specific keywords.
search_keywords( pattern, ignore.case = TRUE, output = c("mid", "print", "data"), ... )search_keywords( pattern, ignore.case = TRUE, output = c("mid", "print", "data"), ... )
pattern |
Character string or regular expression to match against keywords |
ignore.case |
Logical; if TRUE (default), case is ignored during matching |
output |
Output format: "mid" returns milestone IDs (default), "print" prints formatted milestones, "data" returns milestone data frame |
... |
Additional arguments passed to |
This is a convenience function that searches the keyword field in the milestone2keyword table and returns matching milestones.
Depends on output parameter (see search_milestones())
## Not run: # Find milestones tagged with "contour" search_keywords("contour") # Find milestones with statistical keywords search_keywords("statistic") # Print formatted results search_keywords("visualization", output = "print") ## End(Not run)## Not run: # Find milestones tagged with "contour" search_keywords("contour") # Find milestones with statistical keywords search_keywords("statistic") # Print formatted results search_keywords("visualization", output = "print") ## End(Not run)
Search for milestones matching a text pattern (regular expression) across specified fields in the milestone table.
search_milestones( pattern, fields = c("description", "tag", "note"), output = c("mid", "print", "data"), ignore.case = TRUE, ... )search_milestones( pattern, fields = c("description", "tag", "note"), output = c("mid", "print", "data"), ignore.case = TRUE, ... )
pattern |
Character string or regular expression to search for |
fields |
Character vector of field names to search. Default is c("description", "tag", "note"). Other searchable fields include: "slug", "date_from", "date_to", "location", "extra". |
output |
Output format: "mid" returns a numeric vector of milestone IDs, "print" prints formatted milestones and returns them invisibly, "data" returns the matching milestone data frame rows. Default is "mid". |
ignore.case |
Logical; if TRUE (default), case is ignored during matching |
... |
Additional arguments passed to |
The function searches for the pattern across all specified fields using regular expression matching. A milestone is included in the results if the pattern matches in ANY of the specified fields (OR logic).
The pattern argument accepts regular expressions, allowing for
flexible searching:
Simple text: "contour" finds "contour map", "contours", etc.
Multiple terms: "chart|graph" finds either term
Word boundaries: "\\bmap\\b" finds "map" but not "bitmap"
Case patterns: "[Cc]artograph" finds "cartograph" or "Cartograph"
Depends on output:
"mid": Numeric vector of matching milestone IDs
"print": Character vector of formatted milestones (invisibly), with formatted output printed to console
"data": Data frame of matching milestone rows
## Not run: # Find milestones mentioning "statistical" search_milestones("statistical") # Search in specific fields search_milestones("Halley", fields = c("description", "note")) # Use regex to find chart OR graph search_milestones("chart|graph", fields = "description") # Get and print formatted results search_milestones("contour", output = "print") # Get full data frame of matches results <- search_milestones("visualization", output = "data") # Search tags for specific terms search_milestones("^1st", fields = "tag") # Case-sensitive search search_milestones("Map", ignore.case = FALSE) ## End(Not run)## Not run: # Find milestones mentioning "statistical" search_milestones("statistical") # Search in specific fields search_milestones("Halley", fields = c("description", "note")) # Use regex to find chart OR graph search_milestones("chart|graph", fields = "description") # Get and print formatted results search_milestones("contour", output = "print") # Get full data frame of matches results <- search_milestones("visualization", output = "data") # Search tags for specific terms search_milestones("^1st", fields = "tag") # Case-sensitive search search_milestones("Map", ignore.case = FALSE) ## End(Not run)
Retrieve the subject table containing subject classifications that indicate
the substantive context of milestone events.
subject()subject()
A data frame. See subject() for details.
The subject classification indicates the substantive context of the milestone event.
Use milestone2subject() to link milestones to their subjects.
A data frame with 4 rows and 2 variables:
subject id, a numeric vector
subject name (Physical, Mathematical, Human, Other), a character vector
https://datavis.ca/milestones/
## Not run: # Get all subjects subj <- subject() ## End(Not run)## Not run: # Get all subjects subj <- subject() ## End(Not run)