get_instance: Retrieve an instance from the instance list by id

get_instanceR Documentation

Retrieve an instance from the instance list by id

Description

A convenience function that pulls out a single (document) from an InstanceList using its id. Again mostly useful for inspecting the results of stopwording, etc.

Usage

get_instance(instances, id, id_map = instances_ids(instances))

Arguments

instances

a reference to an InstanceList object (from read_instances or trainer$instances)

id

a document id

id_map

map from instance index to id's, to match against id. Calculated by default, but if you're going to do this a lot, precalculate the id_map just once.

Details

To subscript an InstanceList by position, use its own accessor: instances$get(3L). The index is zero-based and must be an integer (not numeric).

Value

reference to a MALLET Instance.


agoldst/dfrtopics documentation built on July 15, 2022, 4:13 p.m.