Split one persona into labeled demographics and labeled answers
Source:R/personas.R
llm_persona_split.RdExtracts 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.
Arguments
- 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
"ideology_score").