Return to site

For loop matrix r

broken image
broken image
broken image
broken image

Within a threshold of 2.0 units, I have tried to measure each user's time against their own time and other users by obtaining the difference with a nested for-loop.īelow is an example of what the clean_data matrix looks like, and this matrix was used for all three goals: M1 M2 M3 M4įor Goal #3, the output should look something akin to this matrix: U1 U2 U3 U4 U5įor example: User 1 has 2 matches with themselves because, with all 4 of their time measurements, 2 differences were less than a value of 2.0 units. To create a final matrix that counts the number of 'matches' (comparisons) each user has against themselves and others.To subtract the user's time from other user's time points (all included, across rows).To subtract the user's time from their own times (across columns).The goals I want to accomplish with this matrix are three fold: Some users only have one measurement of time, while others may have the full 4 measurements. Each row represents a user, and each column a measurement of time. I have a matrix that is 10 rows by 4 columns.