mergen employs artificial intelligence to convert data analysis questions into executable code, explanations, and algorithms. The self-correction feature ensures the generated code is optimized for performance and accuracy. mergen features a user-friendly chat interface, enabling users to interact with the AI agent and extract valuable insights from their data effortlessly.
The package website with full documentation is here.
If you want to use mergen in your Rstudio session via an embedded chatbot, try out our companion package mergenstudio.
The easiest way to install mergen is via
install.packages
install.packages("mergen")
To get a bug fix or to use a feature from the development version, you can install the development version of mergen from GitHub.
# install.packages("pak")
::pak("BIMSBbioinfo/mergen") pak
To interact with an AI API, you require a valid AI API key. To configure your key so that it is present globally in your environment at all times, you can include it in your .Renviron file. This will ensure that the key is automatically loaded.
For setting up mergen, this variable should be called
AI_API_KEY
. For more information on setting up an agent, we
recommend you visit Get Started .
Caution: If you’re using version control systems like GitHub, include .Renviron in your .gitignore file to prevent exposing your personal API key.
Here is how to open your .Renviron file for modification in your project:
require(usethis)
edit_r_environ(scope="project")
For a persistent loading of your API key, add the following line to
your .Renviron file replacing "your_key"
with your key.
="your_key" AI_API_KEY
NOTE: After setting up your API key in the .Renviron
file, either restart the R session or run
readRenviron(".Renviron")
to apply the changes.
If you however wish to set this variable only for a single session, you can use the following command:
Sys.setenv(AI_API_KEY="your_key")
If you used mergen please cite:
If you encounter a clear bug, please file an issue with a minimal reproducible example on GitHub. There you can also post further questions.