Learn R Programming

MobileTrigger (version 0.0.31)

createMessage: HTML Summary of Model Result

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

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

Run this code
# NOT RUN {
################################
# 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)
# }

Run the code above in your browser using DataLab