Overview
Overview of the R Script Module
The R script tool in APM provides a way for you to utilize R and Python programming languages to create scripts that can receive data from inputs, make calculations, and then return one or more outputs. These scripts can then be used within Policy Designer and Family Policies to expand the functionality of policies.
R and Python scripts can be as simple or as complex as you need them to be, depending on the data that you want the script to calculate. For instance, a simple script may calculate and return a value based only on two inputs. A more complex script might utilize ten inputs, and have ten different output values. This documentation does not cover the process of developing R or Python code.
R and Python Scripts in Policies and Family Policies
R and Python scripts can be used to expand the functionality of policy models in Policy Designer and Family Policies. After you create and save a script, you can use the R Script and Python nodes in your policy model to pass values into the script, and receive calculated values out of the script.
The parameters that you define in the script determine how the R Script node or Python node in your policy model will behave. Each parameter that you specify as an input appears as a field in the Properties window for the R Script node or Python node. You can then use standard policy options to provide values to the parameters in the script. Each parameter that you specify as an output determines what values subsequent nodes in the policy model can use for additional calculations or actions.
About Installed R Packages
Package | Version |
---|---|
arrow | 18.1.0.1 |
askpass | 1.2.1 |
assertthat | 0.2.1 |
backports | 1.5.0 |
base64enc | 0.1-3 |
BiocManager | 1.30.25 |
Bit | 4.5.0.1 |
bit64 | 4.6.0-1 |
Blob | 1.2.4 |
Brew | 1.0-10 |
Brio | 1.1.5 |
Broom | 1.0.7 |
Bslib | 0.8.0 |
Cachem | 1.1.0 |
Callr | 3.7.6 |
Cellranger | 1.1.0 |
Cli | 3.6.3 |
Clipr | 0.8.0 |
Clock | 0.7.2 |
Colorspace | 2.1-1 |
commonmark | 1.9.2 |
conflicted | 1.2.0 |
cpp11 | 0.5.1 |
crayon | 1.5.3 |
credentials | 2.0.2 |
curl | 6.2.0 |
data.table | 1.16.4 |
DBI | 1.2.3 |
dbplyr | 2.5.0 |
desc | 1.4.3 |
devtools | 2.4.5 |
diagram | 1.6.5 |
dials | 1.3.0 |
DiceDesign | 1.1 |
diffobj | 0.3.5 |
digest | 0.6.37 |
docopt | 0.7.1 |
doFuture | 1.0.1 |
downlit | 0.4.4 |
dplyr | 1.1.4 |
dtplyr | 1.3.1 |
duckdb | 1.1.3-2 |
ellipsis | 0.3.2 |
evaluate | 1.0.3 |
fansi | 1.0.6 |
farver | 2.1.2 |
fastmap | 1.2.0 |
fontawesome | 0.5.3 |
forcats | 1.0.0 |
foreach | 1.5.2 |
fs | 1.6.5 |
fst | 0.9.8 |
fstcore | 0.9.18 |
furrr | 0.3.1 |
future | 1.34.0 |
future.apply | 1.11.3 |
gargle | 1.5.2 |
generics | 0.1.3 |
gert | 2.1.4 |
ggplot2 | 3.5.1 |
gh | 1.4.1 |
gitcreds | 0.1.2 |
globals | 0.16.3 |
glue | 1.8.0 |
googledrive | 2.1.1 |
googlesheets4 | 1.1.1 |
gower | 1.0.2 |
GPfit | 1.0-8 |
gtable | 0.3.6 |
hardhat | 1.4.0 |
haven | 2.5.4 |
highr | 0.11 |
hms | 1.1.3 |
htmltools | 0.5.8.1 |
htmlwidgets | 1.6.4 |
httpuv | 1.6.15 |
httr | 1.4.7 |
httr2 | 1.1.0 |
IAPWS95 | 1.2.4 |
ids | 1.0.1 |
infer | 1.0.7 |
ini | 0.3.1 |
ipred | 0.9-15 |
isoband | 0.2.7 |
iterators | 1.0.14 |
jquerylib | 0.1.4 |
jsonlite | 1.8.9 |
knitr | 1.49 |
labeling | 0.4.3 |
Lahman | 12.0-0 |
later | 1.4.1 |
lava | 1.8.1 |
lhs | 1.2.0 |
lifecycle | 1.0.4 |
listenv | 0.9.1 |
littler | 0.3.20 |
lubridate | 1.9.4 |
magrittr | 2.0.3 |
memoise | 2.0.1 |
mime | 0.12 |
miniUI | 0.1.1.1 |
modeldata | 1.4.0 |
modelenv | 0.2.0 |
modelr | 0.1.11 |
munsell | 0.5.1 |
numDeriv | 2016.8-1.1 |
nycflights13 | 1.0.2 |
openssl | 2.3.1 |
pander | 0.6.5 |
parallelly | 1.41.0 |
parsnip | 1.2.1 |
patchwork | 1.3.0 |
pillar | 1.10.1 |
pkgbuild | 1.4.6 |
pkgconfig | 2.0.3 |
pkgdown | 2.1.1 |
pkgload | 1.4.0 |
plogr | 0.2.0 |
praise | 1.0.0 |
prettyunits | 1.2.0 |
processx | 3.8.5 |
prodlim | 2024.06.25 |
profvis | 0.4.0 |
progress | 1.2.3 |
progressr | 0.15.1 |
promises | 1.3.2 |
ps | 1.8.1 |
purrr | 1.0.2 |
R6 | 2.5.1 |
ragg | 1.3.3 |
rappdirs | 0.3.3 |
rcmdcheck | 1.4.0 |
RColorBrewer | 1.1-3 |
Rcpp | 1.0.14 |
RcppArmadillo | 14.2.2-1 |
readr | 2.1.5 |
readxl | 1.4.3 |
recipes | 1.1.0 |
rematch | 2.0.0 |
rematch2 | 2.1.2 |
remotes | 2.5.0 |
reprex | 2.1.1 |
rlang | 1.1.5 |
RMariaDB | 1.3.3 |
rmarkdown | 2.29 |
roxygen2 | 7.3.2 |
RPostgres | 1.4.7 |
rprojroot | 2.0.4 |
rsample | 1.2.1 |
Rserve | 1.8-15 |
RSQLite | 2.3.9 |
rstudioapi | 0.17.1 |
rversions | 2.1.2 |
rvest | 1.0.4 |
sass | 0.4.9 |
scales | 1.3.0 |
selectr | 0.4-2 |
sessioninfo | 1.2.2 |
sfd | 0.1.0 |
shape | 1.4.6.1 |
shiny | 1.10.0 |
slider | 0.3.2 |
sourcetools | 0.1.7-1 |
SQUAREM | 2021.1 |
stringi | 1.8.4 |
stringr | 1.5.1 |
sys | 3.4.3 |
systemfonts | 1.2.1 |
testthat | 3.2.3 |
textshaping | 1.0.0 |
tibble | 3.2.1 |
tidymodels | 1.2.0 |
tidyr | 1.3.1 |
tidyselect | 1.2.1 |
tidyverse | 2.0.0 |
timechange | 0.3.0 |
timeDate | 4041.11 |
tinytex | 0.54 |
tune | 1.2.1 |
tzdb | 0.4.0 |
urlchecker | 1.0.1 |
usethis | 3.1.0 |
utf8 | 1.2.4 |
uuid | 1.2-1 |
vctrs | 0.6.5 |
viridisLite | 0.4.2 |
vroom | 1.6.5 |
waldo | 0.6.1 |
warp | 0.2.1 |
WeibullR | 1.2.1 |
whisker | 0.4.1 |
withr | 3.0.2 |
workflows | 1.1.4 |
workflowsets | 1.1.0 |
xfun | 0.5 |
xml2 | 1.3.6 |
xopen | 1.0.1 |
xtable | 1.8-4 |
yaml | 2.3.10 |
yardstick | 1.3.2 |
zip | 2.3.1 |
library()
function. The following R script example loads the WeibullR package and uses the AbPval (Abernethy’s P Value) function: library(WeibullR)
answer <- AbPval(50, 0.996, "lnorm")
Access a Script
Procedure
R and Python Script Workflow
This workflow provides the basic, high-level steps for using this module. The steps and links in this workflow do not reference every possible procedure.
- Create a new R script.
- Enter R or Python code in the script editor.
- Define each parameter in the R script.
- Save the R or Python script.
- Create a policy containing the R Script or Python node in order to execute the script.