Move r library out of repo. More functions added.