Repo has coursera's advanced r course submission
Week 4 Project Questions Part 1: Factorial Function
For this Part you will need to write four different versions of the Factorial function:
1-Factorial_loop: a version that computes the factorial of an integer using looping (such as a for loop) 2-Factorial_reduce: a version that computes the factorial using the reduce() function in the purrr package. Alternatively, you can use the Reduce() function in the base package. 3-Factorial_func: a version that uses recursion to compute the factorial. 4-Factorial_mem: a version that uses memoization to compute the factorial.
After writing your four versions of the Factorial function, use the microbenchmark package to time the operation of these functions and provide a summary of their performance. In addition to timing your functions for specific inputs, make sure to show a range of inputs in order to demonstrate the timing of each function for larger inputs.
Part 2: Longitudinal Data Class and Methods
The variables in the dataset are
id: the subject identification number
visit: the visit number which can be 0, 1, or 2
room: the room in which the monitor was placed
value: the level of pollution in micrograms per cubic meter
timepoint: the time point of the monitor value for a given visit/room
You will need to design a class called “LongitudinalData” that characterizes the structure of this longitudinal dataset. You will also need to design classes to represent the concept of a “subject”, a “visit”, and a “room”.
In addition you will need to implement the following functions
make_LD: a function that converts a data frame into a “LongitudinalData” object
subject: a generic function for extracting subject-specific information
visit: a generic function for extracting visit-specific information
room: a generic function for extracting room-specific information
Enf of course certifiate