Learn R Programming

dhlabR (version 1.0.6)

get_ngram_from_books: Get Ngram Count per Year for National Library Book Collection

Description

This function queries the National Library's book collection API to retrieve the ngram count per year for the specified parameters. It can be used to plot an ngram based on the words' presence in books in the library's collection.

Usage

get_ngram_from_books(
  city = NULL,
  ddk = NULL,
  lang = NULL,
  period = list(),
  publisher = NULL,
  title = NULL,
  topic = NULL,
  word = list("hus", "blokk")
)

Value

A data frame with the ngram count per year for the specified parameters.

Arguments

city

(character, optional) The city of publication. Default is NULL.

ddk

(character, optional) The Dewey Decimal Classification (DDC) code. Default is NULL.

lang

(character, optional) The language code of the books. Default is NULL.

period

(list, optional) A list containing the start and end years of the period to search. Default is an empty list.

publisher

(character, optional) The publisher's name. Default is NULL.

title

(character, optional) The title or a part of the title of the books. Default is NULL.

topic

(character, optional) A topic or subject associated with the books. Default is NULL.

word

(list, optional) A list of words (ngrams) to search for in the books. Default is list("hus", "blokk").

Examples

Run this code
# Get ngram count for the words "hus" and "blokk" in the specified period
get_ngram_from_books(period = list(1990, 2000))

# Get ngram count for the word "library" in English books
get_ngram_from_books(lang = "eng", word = list("library"))

Run the code above in your browser using DataLab