Skip to contents

Extracts the codebook component from qlm_coded, qlm_comparison, and qlm_validation objects. The codebook is a constitutive part of the coding run, defining the coding instrument used.

Usage

codebook(x)

Arguments

x

A quallmer object (qlm_coded, qlm_comparison, or qlm_validation).

Value

A qlm_codebook object, or NULL if no codebook is available.

Details

The codebook is a core component of coded objects, analogous to formula() for lm objects. It specifies the coding instrument (instructions, schema, role) used in the coding run.

This function is an extractor for the codebook component, not a metadata accessor. For codebook metadata (name, instructions), use qlm_meta().

Note: qlm_codebook() is the constructor for creating codebooks; codebook() is the extractor for retrieving them from coded objects.

See also

Examples

# Load example objects
examples <- readRDS(system.file("extdata", "example_objects.rds", package = "quallmer"))
coded <- examples$example_coded_sentiment

# Extract codebook
cb <- codebook(coded)
cb
#> quallmer codebook: Sentiment analysis 
#>   Input type:   text
#>   Role:         You are a political communication analyst evaluating public ...
#>   Instructions: Analyze the sentiment of this text, on both a 1-10 scale and...
#>   Output schema:ellmer::TypeObject
#>   Levels:
#>     sentiment: nominal
#>     rating: interval

# Access codebook metadata
qlm_meta(cb, "name")
#> [1] "Sentiment analysis"