Question: # load packages library ( bench ) # initialize variables x < - 1 : 1 0 0 z < - 1 . 6 #
# load packages
librarybench
# initialize variables
x :
z
# approach I: loop
multiplication
functionxz
result c
for i in :lengthxresult cresult xiz
returnresult
result multiplicationxz
headresult
# approach II: Rstyle"
result x z
headresult
# comparison
benchmarking
mark
result multiplicationxz
result x z
miniterations
benchmarking:
plotbenchmarking type "boxplot"
Compare the several different implementations of a code chunk both regarding timing and memory usage.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
