Integrating InfluxDB database with R for machine learning applications

I’ve stored my IOT data in an InfluxDB database, and I’ve integrated the database with Chronograf, wherein I used Flux to write some queries so as to create some visualizations. Now I wanna go a step forward. I’d like to integrate InfluxDB with programming language tools like R to create additional applications of my IOT data.

For example, I’ve instantaneous voltage and current data pertaining to off-grid solar PV application, stored in InfluxDB database. While SQL queries (Flux/InfluxQL) can be used for generating basic performance measures such as solar energy generation (solar voltagesolar current over time), electrical energy consumption (load voltageload current over time), etc., it is not sufficient to generate advanced measures such as estimation of battery state of charge, measure no of cycles of battery, etc., which would involve using programming language to produce the desired result. Under these circumstances, it is necessary to integrate InfluxDB database with programming language tools like R, to be able to carryout online performance monitoring. We can always convert data into csv file, and upload the data to a tool, and write a code for machine learning application, but that would not result in online monitoring; I’d like to integrate InfluxDB and tool (for instance R) seamlessly that would enable online performance monitoring of off-grid solar PV system.

Any help in this regard will be highly appreciated.