# \donttest{
# Create a coded object
texts <- c("I love this!", "Terrible.", "It's okay.")
coded <- qlm_code(
texts,
data_codebook_sentiment,
model = "openai/gpt-4o-mini",
name = "run1",
notes = "Initial coding run"
)
# Access metadata
qlm_meta(coded, "name") # Get run name
qlm_meta(coded, type = "user") # Get all user metadata
qlm_meta(coded, type = "system") # Get system metadata
# Modify user metadata
qlm_meta(coded, "name") <- "updated_run1"
qlm_meta(coded, "notes") <- "Revised notes"
# Extract components
codebook(coded) # Get the codebook
inputs(coded) # Get original texts
# Custom metadata from human coding
human_data <- data.frame(
.id = 1:5,
sentiment = c("pos", "neg", "pos", "neg", "pos")
)
human_coded <- as_qlm_coded(
human_data,
name = "coder_A",
metadata = list(
coder_name = "Dr. Smith",
experience = "5 years"
)
)
# Access custom metadata
qlm_meta(human_coded, "coder_name") # "Dr. Smith"
qlm_meta(human_coded, type = "user") # All user fields
# }
Run the code above in your browser using DataLab