add maxiter usage to R code

default to 300 if not set as env var