| llm_persona_split | R Documentation |
Extracts row i of a persona frame into two named character vectors: the
demographic fields and the survey/attitude answers. Names are the question
wording when the frame carries a dictionary, otherwise the column handles.
Missing values are dropped, and any score/index column (e.g. ideology_score)
is treated as metadata, not an answer. This is the shared field-extraction
step; how the result becomes prompt text is up to the caller.
llm_persona_split(x, i, drop = "ideology_score")
x |
A persona data frame (see anes_2024_personas). |
i |
Integer row index. |
drop |
Character vector of column names to exclude from both parts
(defaults to |
A list with two named character vectors, demographics and
responses.
llm_persona_demographic_fields(), anes_2024_personas.
data(anes_2024_personas, package = "LLMR")
parts <- llm_persona_split(anes_2024_personas, 1)
names(parts$demographics)[1:3]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.