AI Assistants for Data Analysis

Integrating AI Assistant with the REAAAPP Workflow

Kamarul Imran Musa

Universiti Sains Malaysia

Learning Objectives

  1. Understand the Data Analysis Workflow (REAAAPP)
  2. Explore AI Assistants and their capabilities
  3. Learn how to integrate AI into your workflow

Part 1

The REAAAPP Workflow

The Seven Steps

R - Reading Data

E - Exploring Data

A - making Assumptions

A - Analyzing data

A - Assessing results

P - Presenting results and interpretations

P - Publishing results, codes, dataset

Workflow Visualization

%%{init: {'theme':'base', 'themeVariables': { 'fontSize':'20px'}}}%%
flowchart LR
    A[Read] --> B[Explore] --> C[Assume] --> D[Analyze] --> E[Assess] --> F[Present] --> G[Publish]
    
    style A fill:#e74c3c
    style B fill:#f39c12
    style C fill:#f1c40f
    style D fill:#2ecc71
    style E fill:#3498db
    style F fill:#9b59b6
    style G fill:#1abc9c

Reading → Exploring

Reading:

  • Import data
  • Handle formats
  • Verify integrity

Exploring:

  • Visualize distributions
  • Check patterns
  • Identify outliers and errors
  • Flag missing or inconsistent values

Assuming → Analyzing

Assumptions:

  • Distribution (Normal, Poisson, Bernoulli etc)
  • Independence
  • Random sampling
  • Validity of assessments

Analyzing:

  • Apply methods based on assumptions
  • Fit models
  • Test hypotheses

Assessing → Presenting → Publishing

Assess:

  • Check fit
  • Validate against assumptions
  • Diagnose influential points

Present:

  • Visualize
  • Report
  • Interpret

Publish:

  • Share codes
  • Share data
  • Share documents

Part 2

AI Assistants

What Are AI Assistants?

  • Large Language Models (LLMs)
  • Trained on vast text data
  • Generate code and explanations
  • Available 24/7 or on demand if trained locally
  • Continuously improving

Four Major AI Assistants

Assistant Strength Best For
ChatGPT Broad knowledge General coding
Claude Large context Complex analysis
Gemini Google integration Research
Copilot IDE integration Active coding

R Prompt Generator

A Custom Tool for Structured Prompts

  • Aligned with REAAAPP workflow
  • Reduces ambiguity
  • Improves AI responses
  • Ensures completeness
  • Saves time

Access Here

R Prompt Generator

Part 3

Integration Approach

Integration Philosophy

REAAAPP provides structure

AI Assistants provide acceleration

R Prompt Generator provides clarity

You provide expertise and additional contexts to AI assistant (to minimize hallucinations)

The Complete Integration Process

%%{init: {'theme':'base', 'themeVariables': { 'fontSize':'14px'}}}%%
flowchart LR
    A[R Prompt<br/>Generator] --> B[Generate<br/>Prompt]
    B --> C[Copy to<br/>AI]
    C --> D[Add<br/>Resources]
    D --> E[Generate<br/>Code]
    E --> F[Copy to<br/>RStudio]
    F --> G[Run &<br/>Review]
    G --> H{OK?}
    H -->|Yes| I[End]
    H -->|No| J[Modify<br/>Prompt]
    J --> D
    
    style A fill:#3498db
    style E fill:#2ecc71
    style I fill:#27ae60
    style H fill:#f39c12

Ingredients for Success

  1. REAAAPP Workflow framework
  2. Chosen AI assistant
  3. R Prompt Generator tool
  4. Quality training resources (to add to AI Assistant)
  5. Iterative mindset

Step 1: Generate Prompt

Using R Prompt Generator:

  • Navigate to the tool
  • Select REAAAPP stage
  • Fill in task description
  • Add requirements
  • Generate specific and structured R prompt
  • R Prompt Generator: Access Here

Step 2: Copy to AI Assistant

Prepare Your Request:

  • Choose appropriate AI
  • Open new conversation
  • Paste generated prompt
  • Review for completeness

Step 3: Add Resources

Context is Critical:

  • Data samples (check your data format : csv? or excel?)
  • Variable descriptions (check the variables names)
  • Data dictionary
  • Previous examples (published codes or papers)
  • Method references (R packages vignettes or Quarto documents)
  • Special requirements (Your own notes)

Add Resources or Contexts

Step 4: Generate Solution

AI Creates Your Analysis:

  • AI processes prompt
  • Considers resources
  • Generates complete solution
  • Includes explanations
  • Suggests alternatives

Step 5: Copy to RStudio

Move to Your Environment:

  • Copy generated solution
  • Open RStudio
  • Create new R script or Quarto document
  • Save R script or Quarto document

Step 6: Run the Analysis

Execute and Monitor:

  • Review before running
  • Check package availability
  • Add data
  • Run step by step or chunck by chunk
  • Watch for errors

Step 7: Evaluate Results

Check For:

  • Correct execution
  • Expected outputs
  • Reasonable values
  • Appropriate methods

Ask Yourself:

  • Does this answer my question?
  • Are assumptions met?
  • Do results make sense?
  • What’s missing?

Decision Point

Are you satisfied?

YES

✓ Document

✓ Save

✓ Continue

NO

→ Go to Step 8

→ Refine

→ Iterate

Step 8: Refine and Iterate

When Not Satisfactory:

  1. Identify the issue
  2. Modify prompt
  3. Add more context
  4. Return to Step 3
  5. Generate new solution
  6. Test again

The Iteration Cycle

%%{init: {'theme':'base', 'themeVariables': { 'fontSize':'16px'}}}%%
flowchart LR
    A[Initial<br/>Result] --> B{Good?}
    B -->|No| C[Identify<br/>Issue]
    C --> D[Refine<br/>Prompt]
    D --> E[Add<br/>Context]
    E --> F[New<br/>Solution]
    F --> B
    B -->|Yes| G[Success]
    
    style A fill:#3498db
    style G fill:#27ae60
    style B fill:#f39c12

Best Practices

Do:

  • Use structured prompts
  • Provide context
  • Review outputs
  • Test incrementally
  • Document process

Don’t:

  • Run code blindly
  • Skip review
  • Ignore warnings
  • Over-rely on AI (verify and validate)
  • Forget domain knowledge

Benefits of Integration

Efficiency:

  • Faster development
  • Quick prototyping
  • Reduced errors

Quality:

  • Consistent methods
  • Better documentation
  • Best practices

Ethical Considerations

  • Always verify AI outputs
  • Acknowledge AI assistance
  • Maintain data privacy (should you upload or attach data?)
  • Apply domain expertise
  • Consider limitations (hallucinations, biases)

The Human Element

AI Assistants are tools

You provide:

  • Domain knowledge
  • Critical thinking
  • Quality judgment
  • Final decisions

Getting Started Checklist

Summaries

  • REAAAPP provides structure
  • AI assistants accelerate work
  • R Prompt Generator ensures clarity
  • Integration requires iteration
  • Human judgment is essential

Final Thought

REAAAPP Workflow

AI Assistance

=

Efficient, Quality Analysis

Thank You

Questions?

Start with R Prompt Generator

Practice the integration

Enjoy the learning journey

Get connected

LinkedIn: Kamarul Imran Musa

Personal Website: myanalytics