Use powerful Large Language Models (LLMs) directly in your R workflows for data analysis, visualization, and exploratory research.
llm7R is a lightweight and extensible R wrapper for the LLM7.io API, designed to make it easy to work with text generation, dataframe analysis, and vision-based understanding of plots and images — all from within R.
# Install devtools if not already installed
install.packages("devtools")
# Install llm7R
devtools::install_github("edujbarrios/llm7R")git clone https://github.com/edujbarrios/llm7R.git
cd llm7R
Rscript -e 'source("llm7.R")'source("llm7.R")
client <- create_llm7_client()client$simple_completion(
"Explain gradient descent in simple terms"
)data(iris)
client$analyze_dataframe(
iris,
"What are the key differences between species?"
)png("plot.png")
plot(iris$Sepal.Length, iris$Petal.Length)
dev.off()
client$analyze_plot(
"plot.png",
"Describe the relationship shown in this plot"
)For the best experience while working with dataframes, plots, and long responses, it is recommended to use Jupyter Notebook with the R kernel (IRkernel). This setup provides improved output rendering and interactive workflows.
By default, the client uses a limited-access API key:
api_key = "unused"To unlock full functionality, generate an API token at:
https://token.llm7.io/Then initialize the client with your token:
client <- create_llm7_client(
api_key = "your-token"
)Special thanks to Chigwell for creating and maintaining the LLM7.io API.
Eduardo J. Barrios
https://edujbarrios.com