Professional Spacemacs environment for R package development on macOS
A complete, integrated development environment for R package development powered by Spacemacs:
- π― Modal Editing - Vim-style navigation with discoverable keybindings
- π ESS Integration - Full Emacs Speaks Statistics support with R console and code evaluation
- β Flycheck + Linters - Real-time syntax checking with lintr and custom styler integration
- π LSP Mode - Language Server Protocol for intelligent code navigation and refactoring
- π‘ Smart Completion - Company mode with context-aware autocompletion
- π Roxygen2 Automation - Automatic documentation skeleton generation with parameter detection
- π¨ Auto-Formatting - Styler integration for automatic code formatting on save
- π· S7 Support - Built-in snippets and helpers for R's new S7 OOP system
- π¦ Usethis Integration - Quick commands for creating R files, tests, and documentation
- π Git Integration - Magit for visual Git operations
- π Quarto/LaTeX - Full support for Quarto documents and LaTeX writing
- ποΈ Which-Key - Discoverable keybindings (press
SPCand wait!)
- macOS 12.0+ (tested on macOS 12+)
- Emacs 27.1+ (emacs-plus@30 recommended)
- R 4.0+
- Git 2.0+
- Homebrew (recommended)
## β‘ Installation (Copy-Paste This)
```bash
git clone https://github.com/Data-Wise/spacemacs-rstats.git
cd spacemacs-rstats
./scripts/install.shDone! β Grab coffee (~10 min install time)
π What's happening?
The installer automatically:
- β Checks macOS version, disk space, network
- β Installs Homebrew (if needed)
- β Installs Emacs with native compilation
- β Installs Spacemacs
- β Configures for R development
- β Installs R packages
First Emacs launch: Takes 10-15 min (packages installing)
βοΈ Troubleshooting
Already installed?
./scripts/health-check.sh --pre-flightShows 4 options: check health, update, repair, or reinstall.
Something broke?
./scripts/repair.sh # Interactive menuStart over?
./scripts/install.sh --forceπ€ Advanced options
./scripts/install.sh --skip-checks # Skip pre-flight (not recommended)
./scripts/install.sh --yes # No prompts
./scripts/patch.sh # Update only
./scripts/uninstall.sh # Remove (3 levels)See Installation Management for details.
- Getting Started - Complete setup guide
- Migration Guide - Migrating from vanilla Emacs
- Spacemacs Learning - Complete learning curriculum
- Features - Detailed feature documentation
- Keybindings - Complete keybinding reference
- Configuration - Customization options
- Troubleshooting - Common issues and solutions
| Key | Action | Description |
|---|---|---|
SPC f f |
Find file | Open file with fuzzy search |
SPC f s |
Save file | Save current buffer |
SPC b b |
Switch buffer | Switch to another buffer |
SPC SPC |
Execute | Run command (M-x) |
SPC p f |
Project file | Find file in project |
, s l |
Send line to R | Execute current line in R |
, s r |
Send region to R | Execute selected region in R |
, h i |
Insert roxygen | Generate documentation |
, g g |
Go to definition | Jump to function definition |
SPC e l |
List errors | Show Flycheck errors |
Note:
,is the major mode leader key (equivalent toSPC m). Press, ?in any R file to see all available commands via which-key.
See the complete keybinding reference for more.
- Package Management - Automatic package installation via MELPA
- ESS (R Mode) - Full R integration with console and evaluation
- Flycheck - Syntax checking with lintr and custom styler checker
- LSP Mode - Language Server Protocol with R languageserver
- Company - Smart code completion
- Vertico/Consult - Modern completion framework
- Magit - Visual Git interface
- Projectile - Project management
- Which-Key - Keybinding discovery
- Yasnippet - Code snippets
- Quarto/Polymode - Quarto document support
- AUCTeX - LaTeX integration
- Org Mode - Enhanced org-mode
- Citar - Citation management
r-styler-check.R- External Flycheck checker for stylerexport-gui-path.sh- PATH exporter for macOS GUI Emacs
guides/TUTORIAL.md- Complete user guideguides/CHEAT-SHEET.md- Quick keybinding referenceguides/TROUBLESHOOTING.md- Problem solving guidetests/TEST-CHECKLIST.md- Verification checklist
tests/test-features.R- Interactive feature testingtests/test-roxygen.R- Roxygen generation testing
spacemacs-rstats integrates seamlessly with:
- Terminal Workflow - Use with
rtest,rdoc,rcheckaliases - Claude Code - AI-powered development assistance
- zsh-environment - Modern shell with development tools
- r-package-development - Complete R workflow automation
# 1. Open R package
cd ~/R-packages/active/mypackage
emacs .
# 2. Edit code in Emacs
# - Auto-completion
# - Real-time error checking
# - Roxygen documentation
# - Auto-formatting on save
# 3. Test interactively in R console
# M-x R
# C-RET to send code
# 4. Validate in terminal
rtest # Run tests
rdoc # Build documentation
rcheck # R CMD checkContributions are welcome! Please see CONTRIBUTING.md for guidelines.
- π Report bugs via GitHub Issues
- π‘ Suggest features or improvements
- π Improve documentation
- π§ Submit pull requests
- macOS 12.0+ (Monterey or later)
- Emacs 27.1+ (30.0+ recommended)
- R 4.0+
- Git 2.0+
install.packages(c(
"devtools",
"usethis",
"roxygen2",
"testthat",
"lintr",
"styler"
))install.packages(c(
"languageserver", # LSP support
"s7", # S7 OOP system
"covr", # Test coverage
"pkgdown", # Package websites
"remotes" # Remote packages
))After installation, verify everything works:
# Run automated checks
./scripts/check-dependencies.sh
# Open test file in Emacs
emacs tests/test-features.R
# Follow tests/TEST-CHECKLIST.md for comprehensive testingHaving issues? Check:
- Troubleshooting Guide - Common problems and solutions
- GitHub Issues - Known issues and discussions
- Dependency Checker - Run
./scripts/check-dependencies.sh - Messages Buffer - In Emacs: β h e
MIT License - see LICENSE for details.
Built with:
- GNU Emacs - The extensible text editor
- ESS - Emacs Speaks Statistics
- Material for MkDocs - Documentation theme
- R Project - Statistical computing
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Website: data-wise.github.io/spacemacs-rstats
Made with β€οΈ for the R development community
β Star this repo if you find it useful!