Using AI in EPI 590R
You can complete this class, and the final project, without using AI at all. Students have. If you’d rather learn without AI, that is great (and I am very glad I learned R before AI was available), and nothing in the course requires otherwise.
But I’ve come to realize it’s impossible to prevent AI use in a class like this (and maybe not helpful, given that Google/StackOverflow/other internet sources of information are worse now…), and most of you will use AI assistants for coding at some point, so it’s worth being explicit about how they fit into this course.
This course is about making your analysis something you can re-run, hand to someone else, and check. Almost every habit we cover exists because you cannot trust code you haven’t verified. AI-generated code is a large amount of code you didn’t write, arriving faster than you can read it. The verification problem is the same one we’re already working on; there’s just more of it.
Course policy
You may use AI tools (ChatGPT, Claude, Copilot, Gemini, or anything else) to:
- explain error messages
- help debug code you wrote
- ask for examples of functions we’ve covered
- suggest code you can run to check your own work
- improve comments and written explanations, once you understand the analysis
You may not use them to:
- submit code you can’t explain
- produce a final project you didn’t make the decisions for
- avoid reading the documentation, the slides, or the assignment
- paste in confidential, patient, student, or unpublished research data
You are responsible for everything you submit, including the parts an AI wrote.
AI may suggest the habits we’re trying to break
Ask a model to read in some data and it has a good chance of handing you setwd(), or opening with rm(list = ls()), because it learned from a decade of blog posts that do exactly that. We spend the first morning of this class on why those are a problem.
If a suggestion conflicts with something we covered in class, we covered it for a reason. Go with the class. It can be helpful to suggest specific functions, packages, or habits to the model, and ask it to use those instead of the default it learned from the internet.
A prompt that works
Models do much better when they know what you’re working with and what you’ve already tried.
I'm in an intermediate R course on reproducible workflows.
We use tidyverse, the native |> pipe, {here} for file paths, and
gtsummary 2.x for tables.
I'm trying to:
[specific task]
My data has the following variables:
[paste colnames(nlsy) output]
Here's what I tried:
[paste your code]
Here's the error/output:
[paste it]
Please use current gtsummary syntax, and suggest one way I can
verify the result is right.
Compare with “make me a table 1,” which gets you a table 1 for someone else’s data, in whatever syntax was current when the model was trained.
Be careful with data
The NLSY data that we use in this class is public. Your final project data is also required to be data you can share, so that someone else can reproduce your work. So for the purposes of this class, I’m not worried about you pasting data into a prompt. But in general, you must be very careful about what you paste into a prompt. Don’t paste any data that is confidential or patient-level. If you really need to paste data into a prompt, ask for (or write yourself) code to generate synthetic data that has the same structure, and paste that instead.
Checking AI-assisted work
You are responsible for what your code produces, whether in class or in your research or out in the “real world” where your employer might even encourage you to use AI. You are responsible for checking that the code does what you think it does, and that the results make sense. The point isn’t to run a meaningless ritual, it’s to run checks that would actually catch mistakes (and to know how to spot them). A check that just re-prints your answer isn’t a check. Here are some ideas based on the content from this class:
| If you asked for… | Check that |
|---|---|
| reading in data | nrow(), glimpse(), and summary() match what the codebook says |
| a recoded variable | count(data, old_var, new_var) – every old value maps where you expect |
a tbl_summary() |
the N’s add up to your sample size; missing data is displayed, not silently dropped |
| a regression | the reference level is the one you meant; the coefficient’s sign and rough size are plausible |
inline_text() |
the number in your prose matches the number in the rendered table |
| a function | it works on an edge case: an empty vector, an NA, a single row |
| anything at all | the document still renders from a fresh R session, top to bottom |
For your final project
Include a short AI note in your project’s README (a paragraph is plenty) describing whether you used AI, and roughly what for, and how you checked the results. If you used AI, also include as a file in your repo or uploaded on Canvas a complete transcript of your conversation(s). If you didn’t use AI, say so; that’s absolutely fine. You will not be penalized for using or not using AI, but one point on the rubric reflects the requirement to describe your use (and for it to accurately reflect what you did – it is usually pretty easy for me to tell what is AI-generated).
Resources
- AI at Emory, for university guidance on responsible AI use
- Andrew Heiss’s AI page – I tend to have a similar philosphy to Andrew, but he is a lot more thoughtful and willing to write down his thoughts than I am. See especially his message to students on AI in learning.