pmml: Generate PMML for R objects

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/pmml.R


pmml is a generic function implementing S3 methods used to produce the PMML (Predictive Model Markup Language) representation of an R model. The resulting PMML file can then be imported into other systems that accept PMML.

The same function can also be used to output variable transformations in PMML format. In particular, it can be used as a transformations generator. Various transformation operations can be implemented in R and those transformations can then be output in PMML format by calling the function with a NULL value for the model input and a pmmlTransformations object as the transforms input. Please see the R pmmlTransformations package for more information on how to create the pmmlTransformations object.

In addition, the pmml function can also be called using a pre-existing PMML model as the first input and a pmmlTransformations object as the transforms input. The result is a new PMML model with the transformation inserted as a "LocalTransformations" element in the original model. If the original model already had a "LocalTransformations" element, the new information will be appended to that element. If the model variables are derived directly from a chain of transformations defined in the transforms input, the field names in the model are replaced with the original field names with the correct data types to make a consistent model. The covered cases include model fields derived from an original field, model fields derived from a chain of transformations starting from an original field and mutiple fields derived from the same original field.

This package converts models to PMML version 4.3.

Please note that package XML_3.95-0.1 or later is required to perform the full and correct functionality of the pmml package.

If data used for an R model contains features of type character, these must be converted to factors before the model is trained and converted with pmml.


pmml(model=NULL,"Rattle_Model","Rattle/PMML", description=NULL, 
     copyright=NULL, transforms=NULL, ...)



an object to be converted to PMML.

a name to be given to the model in the PMML code.

the name of the application that generated the PMML code.


a descriptive text for the Header element of the PMML code.


the copyright notice for the model.


data transformations represented in PMML via pmmlTransformations.


further arguments passed to or from other methods.


PMML is an XML based language which provides a way for applications to define statistical and data mining models and to share models between PMML compliant applications. More information about PMML and the Data Mining Group can be found at

The generated PMML can be imported into any PMML consuming application, such as the Zementis ADAPA and UPPI scoring engines which allow for predictive models built in R to be deployed and executed on site, in the cloud (Amazon, IBM, and FICO), in-database (IBM Netezza, Pivotal, Sybase IQ, Teradata and Teradata Aster) or Hadoop (Datameer and Hive).


An object of class XMLNode as that defined by the XML package. This represents the top level, or root node, of the XML document and is of type PMML. It can be written to file with saveXML.



See Also

pmml.ada, pmml.rules, pmml.coxph,, pmml.glm, pmml.hclust, pmml.kmeans, pmml.ksvm, pmml.lm, pmml.multinom, pmml.naiveBayes, pmml.neighbr, pmml.nnet, pmml.randomForest, pmml.rfsrc, pmml.rpart, pmml.svm, pmml.xgb.Booster


# Build a simple lm model
iris.lm <- lm(Sepal.Length ~ ., data=iris)

# Convert to pmml

# Create a pmmlTransformations object
xo <- WrapData(iris)

# Transform the 'Sepal.Length' variable
xo <- MinMaxXform(xo,xformInfo="column1->d_sl")

# Output the tranformation in PMML format
pmml(NULL, transforms=xo)

pmml documentation built on May 19, 2017, 10:09 p.m.

Search within the pmml package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at

Please suggest features or report bugs in the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.