Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st. We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here. Need help or have questions? Drop us a line at [email protected]
Created on 12-01-202312:44 PM - edited on 04-20-202611:45 PM by GrazittiAPI
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