Add Alexandra's R implementation. SimStudy scripts have been turned into
functions and some functions have been renamed in order to avoid name
clashes.