Dependency injection for R