
Write code_gpt() results to Excel workbook
Source: R/07_06_open_ended_coding_code_gpt_to_excel.R
code_gpt_to_excel.RdThis function inserts the coded responses (Code(s) column) from a code_gpt() result table into the corresponding Excel coding workbook created for that question.
Arguments
- coded_tbl
A dataset returned by
code_gpt()with coding results.- path
Directory containing the coding workbook. Defaults to
"Data".
Details
The function locates the workbook named
X Coding Workbook.xlsx, matches coded responses by respondent ID, and writes the codes into theCode(s)of the coding sheet.import_coding()function can be used to import and process the coding workbook.
Use this function immediately after code_gpt() in a pipeline to write the coded results directly to the corresponding Excel workbook.
You do not need to save it as a dataset, as the workbook is updated in place.
For example:
code_gpt(data = survey_data, x = Q5, theme_list = theme_list)
code_gpt_to_excel()This will update Q5 Coding Workbook in place with the coded responses, which can then be imported using import_coding().
Examples
# Update "Q5 Coding Workbook" in place with the coded responses
code_gpt(data = survey_data, x = Q5, theme_list = theme_list) %>%
code_gpt_to_excel()
#> Error in code_gpt(data = survey_data, x = Q5, theme_list = theme_list) %>% code_gpt_to_excel(): could not find function "%>%"