Question: We can also write a for - loop to apply a user - defined function 'checkEvent ( ) ' to each row of a matrix
We can also write a forloop to apply a userdefined function 'checkEvent to each row of a matrix object 'simulatedData' as follows:
val vectorlength nrowsimulatedData
for i in :nrowsimulatedData
vali checkEventsimulatedDatai
Which one of the following is TRUE about this approach?
Question options:
It would be computationally expensive if 'simulatedData' is big.
It will work only if 'simulatedData' has equal number of rows and columns.
It will work only if 'simulatedData' is a matrix of numerical values.
It will take a similar computational time as using the apply function but the code will be a bit bigger.
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
