draft of R version of the click security mdl pandas post