
Extract codebook from quallmer objects
codebook.RdExtracts 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.
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
accessors for an overview of the accessor function system
qlm_codebook()for creating codebooksqlm_meta()for extracting metadatainputs()for extracting input data
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"