R package and Stan code for maximum likelihood and Bayesian modeling of galaxy star formation histories