I'm working on an assignment and have installed the library(microbenchmark).
I would appreciate a quick response so I can hopefully streamline the work to collect the execution times and complete the required programming tasks...
First, I setup the utility to generate execution time comparisons for two different functions.
The code works and I receive the output from the program:
benchmark.height <- microbenchmark(**heart.disease.b** = within(heart.disease.b, height<- height/100), **heart.disease.t** = mutate(heart.disease.b, height=height/100), unit='s', times=10)
print(benchmark.height, signif = 2) Unit: seconds expr min lq mean median uq max neval heart.disease.b 0.00020 0.00020 0.00023 0.00021 0.00022 0.00035 10 heart.disease.t 0.00019 0.00019 0.00027 0.00020 0.00027 0.00084 10 ``````````` however, when I try to display the dataframe heart.disease.b, I see the arithmetic was not performed on the indicated column= height to convert it from cm to meters. Also, the second dataframe = heart .disease.t has not been created..., I receive a "object not found error: ``` Error in head(heart.disease.t) : object 'heart.disease.t' not found ``` So, is it true that microbenchmark is only analyzing the timing of the functions? Is there a way to tell microbenchmark to do the timing analysis and actually execute the functions? Or can I only collect the execution times via microbenchmark and then must run the code separately to accomplish the programming tasks? Thank you in advance for any guidance. John2