add static example and make example R code complete