Extract the nth issue from a IssuesTB object or the nth selector from a SelectorTB object.

extract_nth(x, ...)

# S3 method for class 'IssuesTB'
extract_nth(x, n, verbose = TRUE, ...)

# S3 method for class 'SelectorTB'
extract_nth(x, n, verbose = TRUE, ...)

# Default S3 method
extract_nth(...)

Arguments

x

An object of class IssuesTB or SelectorTB.

...

Currently not used.

n

Integer. Position of the element to extract. 1 is for the first element.

verbose

Boolean indicating whether to print additional information.

Value

If x is a IssuesTB, it returns the nth issue as a IssueTB object. If x is a SelectorTB, it returns the nth selector as a SelectorTB object. If n exceeds the number of issues or selector, returns the last issue / selector with a warning.

Returns NULL if the list is empty.

Examples

issues_selector <- init_selector(
    source = "Local",
    dataset_dir = system.file("data_issues", package = "IssueTrackeR"),
    dataset_name = NULL
)

my_issues <- get_issues(selector = issues_selector)
#> The issues will be read from /home/runner/work/_temp/Library/IssueTrackeR/data_issues/list_issues.yaml.

first_issue <- extract_nth(my_issues, 1)
#> The 1th issue will be extracted.
third_issue <- extract_nth(my_issues, 3)
#> The 3th issue will be extracted.