Skip to contents

Retrieves a whole book(s), passage from a book or a portion of a book or chapter, based on specified criteria such as book, chapter, verse, or alternative selection using author, section, or date.

Usage

select_passage(
  book = NULL,
  chapter = NULL,
  verse = NULL,
  fraction = 1,
  part = 1,
  by = NULL,
  divider = NULL,
  language = "English",
  testament = NULL
)

Arguments

book

A character vector specifying the book name(s) from which to select the passage. Ignored if the by parameter is provided.

chapter

A numeric vector indicating the chapter(s) of the book. If selection by section, author or date is used, the chapter must be set to NULL.

verse

A numeric vector indicating the verse(s) within the chapter.

fraction

A numeric value (default 1) indicating how many equal parts to divide the chapter into.

part

A numeric value specifying which part to return (must be between 1 and fraction).

by

An optional character string for alternative selection criteria. It should be one of "author", "section", or "date". When provided, the book, chapter, and verse parameters must be NULL.

divider

A character vector specifying the author, section or date range to be selected.

language

A character string indicating the language of the passage. Must be one of "English", "Hebrew", or "Greek". Default is "English".

testament

A character string specifying the testament. Must be one of "Old", "New", or "Both" (case-insensitive). This parameter is required.

Value

Returns the selected passage as generated by the retrieve_chapter() function.

Details

This function validates the input parameters and determines the book(s) to be used based on the provided criteria. If the by argument is given, the function leverages helper functions such as by_author(), by_section(), or by_date() to select the appropriate book(s) based on the alternative criterion. The passage is then retrieved via retrieve_chapter(), applying verse filtering and partitioning based on the fraction and part arguments.

Examples

# Example 1: Select a passage by specifying book, chapter, and verse.
select_passage(book = "Genesis", chapter = 1, verse = 1, testament = "Old")
#> [1] "In the beginning God created the heavens and the earth."
select_passage(book = "Mat", chapter = 1, verse = 1:10, testament = "new")
#> Did you mean: Mth ?
#>  [1] "The book of the generation of Jesus Christ, the son of David, the son of Abraham."             
#>  [2] "Abraham begot Isaac; and Isaac begot Jacob; and Jacob begot Judah and his brothers;"           
#>  [3] "and Judah begot Perez and Zerah of Tamar; and Perez begot Hezron; and Hezron begot Ram;"       
#>  [4] "and Ram begot Amminadab; and Amminadab begot Nahshon; and Nahshon begot Salmon;"               
#>  [5] "and Salmon begot Boaz of Rahab; and Boaz begot Obed of Ruth; and Obed begot Jesse;"            
#>  [6] "and Jesse begot David the king.And David begot Solomon of her that had been the wife of Uriah;"
#>  [7] "and Solomon begot Rehoboam; and Rehoboam begot Abijah; and Abijah begot Asa;"                  
#>  [8] "and Asa begot Jehoshaphat; and Jehoshaphat begot Joram; and Joram begot Uzziah;"               
#>  [9] "and Uzziah begot Jotham; and Jotham begot Ahaz; and Ahaz begot Hezekiah;"                      
#> [10] "and Hezekiah begot Manasseh; and Manasseh begot Amon; and Amon begot Josiah;"