LLM Text Generation in R: Practical Prompt Engineering - A Short Course
An 8-Hour Livestream Seminar Taught by Hudson Golino, Ph.D.
Read reviews of this courseThis seminar is part of the AI-Enabled Data Analytics Certification, a series of 4 expert-led courses designed to build practical AI skills for research and data analysis. Contact us to learn how to complete your certification and access special pricing.
Have you ever wondered how to generate text data (for example, new items) automatically for your research project (survey, questionnaire) using AI? Are you interested in having more control over the output of ChatGPT responses (or other LLMs)? Do you want to verify the impact of different prompt engineering techniques on the quality of the items or text data you create with the large language models? If so, this course is for you.
This intensive two-day workshop is designed to provide you with a comprehensive introduction to text generation via LLMs (OpenAI Models: GPT-5.2, the open source OpenAI models GPT-OSS-120b, GPT-OSS-20b, plus other open source models such as Llama-3.3, Llama-4, Qwen-3, and others), with a specific focus on how to use them in the R programming environment using APIs (OpenAI and Groq Cloud Systems).
Whether you are a beginner or an experienced data scientist, this course will equip you with the skills and knowledge needed to harness the full potential of LLMs for text generation, including advanced prompt engineering techniques and API control methods.
Starting June 3, this seminar will be presented as an 8-hour synchronous, livestream workshop via Zoom. Each day will feature two lecture sessions with hands-on exercises, separated by a 30-minute break. Live attendance is recommended for the best experience. But if you can’t join in real time, recordings will be available within 24 hours and can be accessed for four weeks after the seminar.
Closed captioning is available for all live and recorded sessions. Captions can be translated to a variety of languages including Spanish, Korean, and Italian. For more information, click here.
ECTS Equivalent Points: 1
More Details About the Course Content
By the end of this course, you will be able to:
-
- Set up and configure LLM APIs (OpenAI and Groq) within the R environment.
- Apply advanced prompt engineering techniques including role prompting, few-shot learning, chain-of-prompting, and chain-of-thought reasoning.
- Generate high-quality survey items and research materials grounded in psychological theory.
- Extract key concepts from research papers (PDFs) to inform item or text development.
- Implement prompt chaining for complex, multi-step analysis tasks.
- Create automated pipelines for large-scale text generation and analysis.
- Minimize hallucinations through evidence-based grounding techniques.
Computing
This is a hands-on course with instructor-led software demonstrations and guided exercises. These guided exercises are designed for the R programming language, so you should use a computer with a recent version of R (version 4.1.3 or later) and RStudio (version 2022.02.1+461 or later). The names of the packages needed for the course, and how to install them, will be provided during the course.
To follow along with the course exercises, you should have good familiarity with the use of R, including opening and executing data files and programs, as well as performing very basic data manipulation and analyses.
If you’d like to take this course but are concerned that you don’t know enough R, there are excellent online resources for learning the basics. Here are our recommendations.
Who Should Register?
Anyone interested in prompt engineering and text generation with OpenAI Models who has a good working knowledge of R
Outline
Day 1: Exploring the fundamentals of OpenAI models
Introduction to LLMs and API Setup (OpenAI Models: GPT-3.5-TURBO/GPT-4, GPT-4o, GPT-5, the open source OpenAI models GPT-OSS-120b, GPT-OSS-20b, plus other open source models such as Llama-3.3, Llama-4, and others)
-
- Understanding the concept of language models
- Differentiating between the models
- Differentiating API systems with GPUs and LPUs
- Exploring real-world applications
Setting up R environment for LLMs
-
- Installing necessary libraries and packages
- Authenticating with the OpenAI API
- Authenticating with the Groq Cloud System API
- Obtaining API keys
Basic text generation
-
- Creating your first LLM request in R via OpenAI and Groq Cloud APIs
- Generating text for simple prompts in R
- Anatomy of effective prompts for research applications
- Parameter tuning (temperature, max_tokens) for optimal outputs
- Handling responses and formatting output in R
- Hands-on practice
Day 2: Advanced applications and prompt engineering with OpenAI and open-source models
Role prompting and persona development
- System vs. user messages for behavioral control
- Creating expert personas (psychometrician, market researcher, educational psychologist)
- Comparative analysis of role-specific outputs
- Hands-on practice: Generating Big Five personality items using expert personas
Few-shot learning and multi-domain item generation
- Few-shot prompting with domain-specific examples
- Building automated item generation functions
- Creating complete survey batteries with CSV output
- Quality assessment and validation techniques
- Hands-on practice: Job satisfaction scale development across multiple domains
Chain-of-thought reasoning
- Step-by-step problem solving for complex research questions
- Methodological decision-making with LLM assistance
- Statistical analysis planning and assumption testing
- Hands-on practice
Evidence-based grounding and PDF integration
- Minimizing hallucinations through document grounding
- PDF text extraction and preprocessing techniques
- Concept extraction from research literature
- Hands-on practice: Generating theory-informed items from academic papers
Generating text data for topic modeling as an exercise in R
- Text Generation via OpenAI models (and open models) for topic modeling
- Hands-on practice
Reviews of LLM Text Generation in R: Practical Prompt Engineering
“Dr. Golino’s course is an engaging combination of background, conceptual, and applied knowledge. It helped me move from being interested and curious to developing a solid baseline understanding of the topic and its issues and then applying that knowledge to my own work.”
Maggi Mackintosh, U.S. Department of Veterans Affairs
Seminar Information
Wednesday, June 3 –
Thursday, June 4, 2026
Daily Schedule: All sessions are held live via Zoom. All times are ET (New York time).
10:30am-12:30pm (convert to your local time)
1:00pm-3:00pm
Payment Information
The fee of $695 USD includes all course materials.
PayPal and all major credit cards are accepted.
Our Tax ID number is 26-4576270.

Back to Public Seminars