Generate a report for screening disagreements between human and AI decisions
Source:R/report_errors.r
report.Rd
This function generates a report for screening disagreements between human and GPT decisions.
It extracts information from the provided data. The function then compiles this information into a
report using Quarto. The report can be saved in formats as HTML, PDF, Word, or more. The generated
report includes sections for each study, displaying the study ID, title, abstract, and the decision
generated by the GPT API model. The report also includes a section for a comment on the GPT decision,
which the user will provide. The function also provides options to customize the document title,
subtitle, and output directory.
Usage
report(
data,
studyid,
title,
abstract,
gpt_answer,
human_code,
final_decision_gpt_num,
file,
format = "html",
open = TRUE,
document_title,
document_subtitle = "",
directory = getwd()
)Arguments
- data
Data frame containing the screening data of disagreements between human decisions and GPT decisions.
- studyid
Column name for the study ID.
- title
Column name for the title.
- abstract
Column name for the abstract.
- gpt_answer
Column name for the AI's answer.
- human_code
Column name for the human screening decision (numeric 0/1).
- final_decision_gpt_num
Column name for the final numeric GPT decision (0/1).
- file
Name of the output file. You can also provide a full path.
- format
Format of the output file. Valid formats are 'html', 'pdf', 'docx'.
- open
Logical indicating whether to open the report after generation. Default is TRUE.
- document_title
Title of the document.
- document_subtitle
Subtitle of the document. Default is an empty string.
- directory
Directory where the output file will be saved. Default is the current working directory.
Value
An object of class 'report'. The object is a list containing the following components:
- file_out
string indicating the path to the generated report file.
- ...
some additional attributed values/components, including an attributed list with the arguments used in the function.
Examples
if (FALSE) { # \dontrun{
# Generate a report from the disagreements data
report(
data = disagreements,
studyid = studyid,
title = title,
abstract = abstract,
gpt_answer = longest_answer,
human_code = human_code,
final_decision_gpt_num = final_decision_gpt_num,
file = "Screening_Disagreements_Report",
format = "html",
document_title = "Study Report - Disagreement Explanations",
open = TRUE
)
} # }