Created on 12-01-202312:44 PM - edited on 12-05-202302:16 AM by VidyaSargur
Shaun goes into great depth on all the capabilities of CML and DataViz in this blog, using a Python model or script. Here, I'll write the script in R instead of the sample Python script Shaun shares.
There is no need to have an R script with predictive model capabilities. While an R script with predictive model capabilities is an option, I'll demonstrate deploying a simple R script in CML that adds two columns together.
Step 1: Write your R script
As explained above, this script adds two columns together (assuming both columns are of type integer). Within DataViz, we'll pass two columns (of type integer). The cml_model wrapper is necessary with the PBJ runtime, as explained here.
Notice the "json" is what we'll be returning to DataViz, where we expect the "numbers_added" column
input[1] and input[2] are representing the two integer columns being passed