doc_formula function

Create rd formula