registerFunction: Register a user-defined function to be used with a...

Description Usage Arguments Details See Also Examples

View source: R/core-functions.R

Description

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

Usage

1
2
3
4
5
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

1
2
3
4
5
6
7
8
9
## Not run: 
  library(analysisPipelines)
  getNumRows <- function(dataset){
   return(nrow(dataset))
  }

  registerFunction("getNumRows")

## End(Not run)

analysisPipelines documentation built on July 1, 2020, 7:09 p.m.