Minitab Statistical Software integrates with R, a statistics programming language with applications in data science. To accomplish R integration, Minitab, LLC provides the mtbr package. With this custom package, you can create tables, graphs, messages, and notes in R and display them in Minitab. R integration offers the flexibility of custom R code within Minitab's easy-to-use interface, and the results can be saved, stored, and shared in Minitab Project Files. After you install the mtbr package, you're ready to run R code from Minitab. If you have R code that you want to access routinely, you can customize Minitab's interface to make the analysis more accessible through custom buttons or menus.
For more information on Minitab's R package, including R code examples, go to R API Reference.
For more information on R, consult the guidance available at www.r-project.org.
All the files referenced in this guide are available in this .ZIP file: r_guide_files.zip.
Install and run R before you attempt to integrate R with Minitab Statistical Software. For assistance with the installation of R, please consult with your organization's technical support department. Minitab Technical Support cannot assist with the installation of R.
If you are using R through an Anaconda environment, go to Additional instructions for Anaconda environments.
To use R with Minitab, install the mtbr package. The mtbr package gives you the capability to bring data from Minitab into R and to return R results to Minitab. Complete the following steps to install the latest version of the mtbr package.
install.packages("C:/Users/username/Downloads/mtbr_0.2.1.zip", repos = NULL)
After R and the mtbr package are installed, you can use the RSCR command to run R from Minitab.
Use the following steps to verify that Minitab can find R and mtbr.
|test.R||A sample R script used throughout this guide. For this section, you run the script without arguments. When the script runs successfully, the result is the message "Minitab successfully located your R installation."|
If the Minitab Command Line is not visible, choose .
Typically, R integration with Minitab works best when the files that you use are in the default folder location for Minitab files. If you do not specify a file path when you run R from within Minitab, Minitab looks for your R files in the default folder.
The default location is the "My Documents" folder.
In the Microsoft® Windows operating system, if your R file is in the default folder and you receive the error "File not found:", check the default file location in your Minitab settings. To view or change the default file location in Minitab, choose .
If the location is correct and you receive the error "Cannot open file:", examine the file path in Minitab's output for invalid or missing characters. If the file path contains invalid or missing characters, try moving or renaming the file.