makeDecisionTable: Produce generalized decision tables with provided confidence...

Description Usage Arguments Value Examples

View source: R/GeneralDecisionTableFunction.R

Description

This function produces a decision table with dimensions based on those of the provided data matrix or the specified dimensions if data is provided as vector. Labels, figure layout and dimensions, and coloring scheme, can be customized. Confidence intervals may be specified using the upper bounds provided in Data_UpperCI and lower bounds provided in Data_LowerCI data inputs (confidence intervals are not automatically generated). Up to three icons may be printed next to the title, and a summary information can also be automatically calculated and appended as the last row of the decision table.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
makeDecisionTable(
  data,
  rownames = NULL,
  colnames = NULL,
  nrow = NULL,
  ncol = NULL,
  byrow = TRUE,
  OutputDirectory = getwd(),
  OutputFileName = "DecisionTable",
  GraphicTitle = "Title",
  RowHeader = "Row_Header",
  ColumnHeader = "Column_Header",
  figureWidth = 500,
  figureHeight = 800,
  resolution = 1,
  graphicCellWidths = NULL,
  graphicCellHeight = NULL,
  barWidth = 1,
  yscalerow = "FALSE",
  SummaryRowOption = "Off",
  visualRank = "FALSE",
  BestPerformanceVector = NULL,
  SummaryBestPerformance = NULL,
  barColors = NULL,
  IncludeCI = "FALSE",
  Data_UpperCI = NULL,
  Data_LowerCI = NULL,
  IconList = NULL,
  IconColor = "black"
)

Arguments

data

A data matrix with dimensions matching the desired decision table or a vector equal in length to the number of cells in the desired decision table. By default vectors will fill the table by column according to the dimensions specified by 'nrow' and 'ncol' arguments, no default.

rownames

A vector of strings equal in length to the number of rows to be used as row names for the decision table when data is provided as a vector, no default.

colnames

A vector of strings equal in length to the number of columns to be used as column names for the decision table when data is provided as a vector, no default.

nrow

A number indicating the number of rows to be included when data is provided as a vector, no default.

ncol

A number indicating the number of columns to be included when data is provided as a vector, no default.

byrow

A boolean string indicating whether data provided as a vector fills the table by row or not, default = TRUE.

OutputDirectory

A string containing the full path name of folder where resulting graphic should be stored, default = current working directory

OutputFileName

A string containing the file name for the resulting graphic, default = "DecisionTable"

GraphicTitle

A string containing the title for the decision table graphic, default = "Title"

RowHeader

A string containing the descriptive title for row names, default = "RowHeader"

ColumnHeader

A string containing the descriptive title for column names, default = "ColumnHeader"

figureWidth

A number specifying total graphic image width in number of pixels, default = 500

figureHeight

A number specifying total graphic image height in number of pixels, default = 800

resolution

A number between 1 and 3, default = 1. This parameter increases the image resolution by scaling the number of pixels in the length and width by an equal amount. Increasing the resolution (higher numbers) will result in a larger image which can be adjusted in any image processing software to the desired dimension.

graphicCellWidths

A vector of length 2 specifying first the width of row label column second data column width

graphicCellHeight

A number specifying height of graphic rows containing data

barWidth

A number specifying the width of the plotted bar

yscalerow

A string specifying the type of scaling for the y-axis of bar charts, if = "TRUE" the y-axis scale is chosen independently for each row, else the scale is chosen for the entire decision table, default = "FALSE"

SummaryRowOption

A string indicating summary row option, default = "Off" (no summary row)

"Off" = No summary row

"MeanRank" = Summary row added, values represent mean rank across all rows in each column, highest rank correspond with best performance

"SumRank" = Summary row added, values represent summed rank across all rows in each column, highest rank correspond with best performance

"MedianRank" = Summary row added, values represent median rank across all rows in each column, highest rank correspond with best performance

"MeanValue" = Summary row added, values represent mean value of Data across all rows in each column, high/low value corresponding with best performance must be specified

"SumValue" = Summary row added, values represent sum of Data values across all rows in each column, high/low value corresponding with best performance must be specified

"MedianValue" = Summary row added, values represent median value of Data across all rows in each column, high/low value corresponding with best performance must be specified "WhiskerPlot" = Summary row added, box and whisker plot summarizes data contained in each column, high/low value corresponding with best performance must be specified

visualRank

A string specifying the use of color to visually show ranked relative performance, if = "TRUE" then 'BestPerformanceVector' and 'SummaryBestPerformance' (if summary row included) must be provided and the 'barColors' argument should be set to "defaultRankColor" or provided a vector of unique colors equal in lenght to the number of columns. Default = "FALSE"

BestPerformanceVector

A vector equal in length to the number of rows in Data containing "High" or "Low". Default = NULL. "High" = highest value in row will be colored to represent best performance "Low" = lowest value in row will be colored to represent best performance

SummaryBestPerformance

A string containing "High" or "Low" to indicate best performance for summary row, no default. Only required if "MeanValue", "SumValue", "MedianValue", or "WhiskerPlot" options chosen. For other options higher summarized rank correspond with better performance

barColors

A string specifying single color OR a vector of colors equal in length to the number of data columns, OR "defaultRankColor" which uses default colors to denote ranked performance. Default = grey columns.

IncludeCI

A string specifying the inclusion of confidence levels in plot, if = "TRUE" then Data_UpperCI and Data_LowerCI must also be provided. Default = "FALSE"

Data_UpperCI

A matrix containing upper confidence levels with row and column names that match Data (must me matrix even if only 1 row or column), no default.

Data_LowerCI

A matrix containing lower confidence levels with row and column names that match Data (must me matrix even if only 1 row or column), no default.

IconList

A vector of icons (identified by string names) to be printed right of the GraphicTitle, length may not exceed 3, default = no icons. A custom black-and-white icon may be printed by providing the filename with .png extension, or an icon supported by the package may be chosen by providing one of the following icon names: "Commercial_Fisheries_Herring_Mackerel_Lobster", "Environmental_Considerations", "Groundfish_Fishery", "Groundfish_Species", "Herring_Fishery_Option1", "Herring_Fishery_Option2", "Lobster", "Lobster_Fishery", "Predator_Fisheries_Tuna_Haddock_Flatfish", "Predator_Species_Tuna_Haddock_Flatfish", "Primary_Production", "Protected_Species", "Protected_Species_and_Tourism", "Tourism", "Tuna", "Tuna_Fishery"

IconColor

A string specifying the color of icons to be printed, only necessary if IconList provide. default = "black"

Value

Customized decision table image (.png) with optional confidence intervals on bars.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# Produce example decision table and save as DecisionTable.png in current working directory.

# Example dataframe
set.seed(1)
data_df <- matrix(c(abs(rnorm(30,20,sd=5))), ncol = 5, nrow = 6)
colnames(data_df) <- c("Column 1", "Column 2", "Column 3", "Column 4", "Column 5")
rownames(data_df) <- c("Row 1", "Row 2", "Row 3", "Row 4", "Row 5", "Row 6")

# Decision table with efault graphic settings, custom title and headers
makeDecisionTable(data = data_df, OutputFileName = "Example1",
                  OutputDirectory = tempdir(),
                  GraphicTitle = "Example decision table with default formatting",
                  RowHeader = "Row header \n describes type \n of data in rows",
                  ColumnHeader = "Column header describes type of data in columns")
# Decision table with ranked coloring scheme, darker colors correspond with
# better (larger) values in each row
makeDecisionTable(data = data_df, OutputFileName = "Example2",
                  OutputDirectory = tempdir(),
                  GraphicTitle = "Example decision table with ranked performance",
                  RowHeader = "Row header \n describes type \n of data in rows",
                  ColumnHeader = "Column header describes type of data in columns",
                  BestPerformanceVector = rep("High", nrow(data_df)),
                  barColors = "defaultRankColor", visualRank = "TRUE")
# Decision table with summary row showing sum values for each column, single custom color.
makeDecisionTable(data = data_df, OutputFileName = "Example3",
                  OutputDirectory = tempdir(),
                  GraphicTitle = "Example decision table with summary row",
                  RowHeader = "Row header \n describes type \n of data in rows",
                  ColumnHeader = "Column header describes type of data in columns",
                  barColors = "cadetblue3", SummaryRowOption = "SumValue",
                  SummaryBestPerformance = "High")

ahart1/decisiontable documentation built on March 17, 2021, 4:18 a.m.