Large Language Models (LLMs), such as GPT (GPT-5.5) by OpenAI and Gemini (Gemini 3.2 Pro) by Google DeepMind, have shown impressive capabilities in text generation and code assistance. This study evaluates their performance in generating R code—that is, computer scripts written in the R programming language for statistical analysis—using both classic educational datasets, including “The Lady Tasting Tea”, “Titanic”, “Iris”, and more recent datasets likely not included in the models’ training data. We assess the accuracy, readability, and educational relevance of the generated code, providing both quantitative and qualitative evaluations that highlight strengths and limitations of LLMs. Our findings suggest that while LLMs generate correct and interpretable R code in many cases, critical human oversight remains essential when integrating AI into educational contexts to ensure rigor and avoid potential misuse.
Bella et al. (Thu,) studied this question.