AI Tools for R
Day 1 - Introduction to Data Analysis with R
Selina Baldauf
Freie Universität Berlin - Theoretical Ecology
March 14, 2025
Motivation
- AI tools assist programmers with
- Coding
- Debugging
- Learning
- …
- Higher productivity and efficiency
- More motivation
- But careful: You still need to understand what’s going on!
R Tutor
- https://rtutor.ai/
- Free browser tool
- Upload data and ask questions about it
- Use the demo data
Julius AI
- https://julius.ai/
- Try for free
- Basic plan ~20€ per months (-50% academic discount)
- Upload data and ask questions about it
Github Copilot
- https://github.com/features/copilot
- Model based on GPT-4 and OpenAI’s Codex
- Specifically trained on source code
- Basic idea: Integrate directly into R Studio (or other IDEs)
- Works best for well-represented languages (Python, JS, …)
How to get GitHub Copilot
See this website for step-by-step guide and more information.
It’s really easy, but you need:
- GitHub Account
- Active GH Copilot subscription (10$ per month)
- Get it for free as an academic with an educational account
- IDE that supports Copilot
- Full support: Visual Studio (Code), Vim, Neovim, JetBrains IDEs (e.g. PyCharm)
- Limited support: RStudio, ?
GH Copilot: Inline code suggestions
- Copilot tries to predict what you want to do next
- Suggestions are based on the context
- Previous code
- Comments
- Variable and function names
- …
Get better suggestions
- Provide context
- Open other files
- Add top level comments explaining the purpose of the script
- Name variables and functions properly
- Copy-paste sample code and delete it later
- Be consistent
- “Garbage in, garbage out”
- Have a nice and consistent coding style
Nice side effect of using Copilot: More good-practice coding
Chat with GH copilot in R Studio
Concerns to consider
- Privacy
- Chose whether your prompts and suggestions will be used by Github (
Github -> Seetings -> Copilot -> Policies
)
- Check privacy guidelines before you upload data
- Plagiarism
- Block suggestions matching public code (
Github -> Seetings -> Copilot -> Policies
)
- Ethical concerns
- For-profit tool trained on open-source
- Environmental concerns
Usage guidelines
- No definite guidelines, but see examples listed here
- Responsibility
- You are responsible for your scientific output
- Stay critical, double-check
- Transparency
- Make clear for which tasks you used which AI
- Know relevant guidelines
- Still understand what is happening!