edited the R file to complete the listed functions