
Process code_gpt() output to the dataset
Source: R/07_05_open_ended_coding_code_gpt_to_df.R
code_gpt_to_df.RdThis function takes a code_gpt() result table and merges binary Unchecked/Checked code variables back into the original survey dataset, preserving labels and metadata.
Arguments
- coded_tbl
A dataset returned by
code_gpt()with coding results.
Value
The original dataset specified in code_gpt() with factor-coded variables (levels: Unchecked, Checked) appended for each code.
Details
Use this function immediately after code_gpt() in a pipeline, and save the result as a dataset.
For example:
data <- code_gpt(data = survey_data, x = Q5, theme_list = theme_list)
code_gpt_to_df()This will append binary coded_ variables for each code in the list.
Examples
# Code Q5 and add to the dataset
data <- code_gpt(data = survey_data, x = Q5, theme_list = theme_list) %>%
code_gpt_to_df()
#> Error in code_gpt(data = survey_data, x = Q5, theme_list = theme_list) %>% code_gpt_to_df(): could not find function "%>%"