To accomplish R integration with Minitab Statistical Software, Minitab, LLC provides the mtbr package. The following descriptions of the functions from the mtbr package prepare you to write R code that integrates with Minitab.
For information on how to install Minitab's R package and how to run R from Minitab, go to Installing R to use with Minitab Statistical Software.
For more information on R, consult the guidance available at www.r-project.org.
mtb_get_columnRetrieves a column from a Minitab worksheet to use in R.
atomic vector. The
atomic vector can contain character or
numeric values.
library(mtbr)
column1 <- mtb_get_column("C1")
column2 <- mtb_get_column("My Column")
mtb_get_constantRetrieves a constant from a Minitab worksheet to use in R.
library(mtbr)
constant1 <- mtb_get_constant("K1")
constant2 <- mtb_get_constant("My Constant")
mtb_get_matrixRetrieves a matrix from a Minitab worksheet to use in R.
matrix.
library(mtbr)
matrix1 <- mtb_get_matrix("M1")
matrix2 <- mtb_get_matrix("My Matrix")
mtb_add_messageAppends a message to the Minitab Output pane.
Null
library(mtbr)
mtb_add_message("This is a message.")
mtb_set_noteSets a note at the top of the Minitab Output pane.
Null
library(mtbr)
mtb_set_note("The output contains one note.")
mtb_set_titleSets the title at the top of the Minitab Output pane.
Null
library(mtbr)
mtb_set_title("The output contains one title.")
mtb_add_imageAppends an image to the Minitab Output pane when you have a supported image file.
Null
library(mtbr)
png("histogram.png")
hist(airquality$Temp)
dev.off()
mtb_add_image("histogram.png")
mtb_add_image_bytesAppends an image to the Minitab Output pane when you have a bytes object.
raw vector as the parameter.
Null
library(mtbr)
image_data <- as.raw(c(0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a,
0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48,
0x44, 0x52, 0x00, 0x00, 0x00, 0x09, 0x00,
0x00, 0x00, 0x09, 0x08, 0x02, 0x00, 0x00,
0x00, 0x6f, 0xf3, 0x91, 0x47, 0x00, 0x00,
0x00, 0x01, 0x73, 0x52, 0x47, 0x42, 0x00,
0xae, 0xce, 0x1c, 0xe9, 0x00, 0x00, 0x00,
0x04, 0x67, 0x41, 0x4d, 0x41, 0x00, 0x00,
0xb1, 0x8f, 0x0b, 0xfc, 0x61, 0x05, 0x00,
0x00, 0x00, 0x09, 0x70, 0x48, 0x59, 0x73,
0x00, 0x00, 0x16, 0x25, 0x00, 0x00, 0x16,
0x25, 0x01, 0x49, 0x52, 0x24, 0xf0, 0x00,
0x00, 0x00, 0x22, 0x49, 0x44, 0x41, 0x54,
0x18, 0x57, 0x63, 0xd8, 0x61, 0xbb, 0x8b,
0x81, 0x01, 0x27, 0x49, 0xba, 0x04, 0x01,
0x69, 0x9c, 0x12, 0x04, 0xa4, 0x71, 0x4a,
0x10, 0x90, 0xc6, 0x29, 0xb1, 0xc3, 0x76,
0x17, 0x00, 0xfc, 0x0b, 0x45, 0x08, 0x6f,
0x2c, 0xff, 0xe2, 0x00, 0x00, 0x00, 0x00,
0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60,
0x82))
mtb_add_image_bytes(image_data)
mtb_add_tableAppends a table to the Minitab Output pane.
list of
atomic vectors or as a
data.frame.
character vector.
"".
"".
Null
library(mtbr)
mytitle <- "Air Quality Data"
myheaders <- names(airquality)
mycolumns <- airquality
myfootnote <- gsub("\"", "", paste0(capture.output(summary(airquality)[4,]), collapse = "\n"))
mtb_add_table(columns=mycolumns, headers=myheaders, title=mytitle, footnote=myfootnote)
By default, Minitab uses a different
datetime format than
R. To convert from the Minitab
datetime format to the Unix
datetime format, use the
excel_numeric_to_date() function from the
janitor
R package.
R on Microsoft® Windows cannot always process strings that have characters from different character sets. For example, if Microsoft® Windows uses the Japanese (Shift-JIS) character set and a string includes characters from the Chinese (GBK) character set, some strings will not be processed correctly.
Because of this limitation, one possible solution is that strings use characters from the same character set as the Microsoft® Windows display language.