registerFunction {analysisPipelines}R Documentation

Register a user-defined function to be used with a AnalysisPipeline or StreamingAnalysisPipeline object

Description

Register a user-defined function to be used with a AnalysisPipeline or StreamingAnalysisPipeline object

Usage

registerFunction(functionName, heading = "", functionType = "batch",
  engine = "r",
  exceptionFunction = as.character(substitute(genericPipelineException)),
  isDataFunction = T, firstArgClass = "", loadPipeline = F,
  userDefined = T)

Arguments

functionName

name of function to be registered

heading

heading of that section in report

functionType

type of function - 'batch' for AnalysisPipeline objects, 'streaming' for StreamingAnalysisPipeline objects

engine

specifies which engine the function is to be run on. Available engines include "r", "spark", and "python"

exceptionFunction

R object corresponding to the exception function

isDataFunction

logical parameter which defines whether the function to be registered operates on data i.e. the first parameter is a dataframe

firstArgClass

character string with the class of the first argument to the function, if it is a non-data function

loadPipeline

logical parameter to see if function is being used in loadPipeline or not. This is for internal working

userDefined

logical parameter defining whether the function is user defined. By default, set to true

Details

The specified operation along with the heading and engine details is stored in the registry, after which it can be added to a pipeline.

If the function already exists in the registry, registration will be skipped. In order to change the definition, the function needs to be reassigned in the Global Environment and then the registerFunction called again.

See Also

Other Package core functions: BaseAnalysisPipeline-class, MetaAnalysisPipeline-class, assessEngineSetUp, checkSchemaMatch, createPipelineInstance, exportAsMetaPipeline, generateOutput, genericPipelineException, getInput, getLoggerDetails, getOutputById, getPipelinePrototype, getPipeline, getRegistry, initDfBasedOnType, initialize,BaseAnalysisPipeline-method, loadMetaPipeline, loadPipeline, loadPredefinedFunctionRegistry, loadRegistry, prepExecution, savePipeline, saveRegistry, setInput, setLoggerDetails, updateObject, visualizePipeline

Examples

## Not run: 
  library(analysisPipelines)
  getNumRows <- function(dataset){
   return(nrow(dataset))
  }

  registerFunction("getNumRows")

## End(Not run)

[Package analysisPipelines version 1.0.2 Index]