createMessage: HTML Summary of Model Result

Description Usage Arguments Value Examples

Description

Function takes i) a selected model from the TRIGGER_PATH]/Models/ folder and the results and makes an HTML summary for the e-mail message response.

Usage

1
createMessage(ID, path = NULL, outputData)

Arguments

ID

integer, Model ID value determined from MobileTrigger::ListModels() output when SelectMDL = NULL

path

string, path to the /Models/ folder.

outputData

data.frame, table with model, inputs, and outputs.

Value

A HTML summary for e-mail message response.

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
################################
# createMessage Example        #
################################

MDLpath <- 'c:/triggers/Models/'
InputPath <- 'c:/triggers/modelInput.txt'

# Read Data and Model -----------------------------------------------------
Input <- MailTriggerInput(InputPath=InputPath)

# Load Selected Model -----------------------------------------------------
MDL <- GetModel(ID = Input$ID, path = MDLpath)
# Predict -----------------------------------------------------------------
if(MDL == 'No Models in Path'){
}else if(!is.null(MDL[[1]]$scaled)){
 if(MDL[[1]]$scaled == T){
   Input$data$Prediction <-
   unlist(predict(MDL[[1]], Input$data)) * MDL[[1]]$outRange + MDL[[1]]$outMin}
  }else{
   Input$data$Prediction <- unlist(predict(MDL[1], Input$data))
}

# Build Message -----------------------------------------------------------
msg <- createMessage(ID = Input$ID,
                    path = MDLpath,
                    outputData = Input$data)
# Send Message ------------------------------------------------------------
# ...

kenithgrey/MobileTrigger documentation built on May 20, 2019, 12:36 p.m.