Unlock insights from your spaced repetition learning journey
If you’re serious about learning, chances are you’ve encountered Anki—the powerful, open-source flashcard application that uses spaced repetition to help you remember anything. Whether you’re studying medicine, languages, programming, or any other subject, Anki has likely become an indispensable part of your learning toolkit.
But have you ever wondered what stories your flashcard data could tell? How your review patterns have evolved over time? Which decks demand the most cognitive effort? That’s exactly why I created ankiR.
What is ankiR?
ankiR is an R package that lets you read, analyze, and visualize your Anki collection data directly in R. Under the hood, Anki stores all your notes, cards, review history, and settings in a SQLite database. ankiR provides a clean, user-friendly interface to access this treasure trove of learning data.
Installation
ankiR is available on CRAN and R-universe, making installation straightforward:
From CRAN
install.packages("ankiR")
From R-universe (development version)
# Enable the r-universe repositoryoptions(repos = c( chrislongros = "https://chrislongros.r-universe.dev", CRAN = "https://cloud.r-project.org"))# Install ankiRinstall.packages("ankiR")
Key Features
- Read Anki databases: Access your collection.anki2 file or unpack .apkg exports
- Extract review history: Analyze your complete review log (revlog table)
- Access cards and notes: Work with your flashcard content programmatically
- Deck analysis: Examine deck structures and configurations
- Model inspection: Understand your note types and templates
Quick Start Example
Here’s how easy it is to start exploring your Anki data:
library(ankiR)# Connect to your Anki collection# (Find it at ~/.local/share/Anki2/User 1/collection.anki2 on Linux)conn <- read_anki("path/to/collection.anki2")# Get your review historyreviews <- get_revlog(conn)# Analyze review patternslibrary(ggplot2)ggplot(reviews, aes(x = as.Date(as.POSIXct(id/1000, origin = "1970-01-01")))) + geom_histogram(binwidth = 1) + labs(title = "Daily Review Activity", x = "Date", y = "Number of Reviews")# Don't forget to close the connectionclose_anki(conn)
Why Analyze Your Anki Data?
Understanding your learning patterns can help you:
- Optimize study habits: Identify your most productive review times
- Track progress: Visualize your learning journey over weeks, months, or years
- Identify problem areas: Find cards or decks with high lapse rates
- Research: Contribute to the growing body of spaced repetition research
- Build custom tools: Create personalized dashboards and reports
Understanding Anki’s Database Structure
For those curious about what’s under the hood, Anki stores data in several tables:
- notes: Your actual flashcard content (fields, tags)
- cards: Individual review items generated from notes
- revlog: Complete history of every review you’ve ever done
- col: Collection metadata, deck configurations, and models
ankiR abstracts away the complexity of parsing JSON-encoded columns and timestamp conversions, giving you clean data frames ready for analysis.
Links and Resources
- CRAN: https://cran.r-project.org/web/packages/ankiR/
- R-universe: https://chrislongros.r-universe.dev/ankiR
- Bug reports: Feel free to open issues on the package repository
Related Projects
If you’re interested in spaced repetition and R, you might also want to check out:
- FSRS: The Free Spaced Repetition Scheduler algorithm, which Anki now supports natively
- anki-snapshot: Git-based version control for Anki collections
Conclusion
Your Anki reviews represent countless hours of deliberate practice. With ankiR, you can finally extract meaningful insights from that data. Whether you’re a medical student tracking board exam prep, a language learner monitoring vocabulary acquisition, or a researcher studying memory, ankiR gives you the tools to understand your learning at a deeper level.
Give it a try, and let me know what insights you discover in your own data!
ankiR is open source and contributions are welcome. Happy learning!




