calc_dist

calc_dist(track, cumulative = TRUE)

Arguments

track

Mouse track containing x any y coordinates

cumulative

Return distance as cumulative sum or not, logical, default is true

Value

mouse track including distance

Details

Calculate distance in pixels between track points that are of type 'Move'.

Examples

calc_dist(mouse_df)
#> # A tibble: 11,299 x 9 #> type x y button pressed dx dy date dist #> <chr> <dbl> <dbl> <chr> <chr> <chr> <chr> <dttm> <dbl> #> 1 Move 108. 1047. NA NA NA NA 2021-01-10 14:45:47 0 #> 2 Move 108. 1047. NA NA NA NA 2021-01-10 14:45:47 0.294 #> 3 Move 109. 1047. NA NA NA NA 2021-01-10 14:45:47 0.910 #> 4 Move 110. 1047. NA NA NA NA 2021-01-10 14:45:47 1.89 #> 5 Move 110. 1047. NA NA NA NA 2021-01-10 14:45:47 2.69 #> 6 Move 111. 1047. NA NA NA NA 2021-01-10 14:45:47 3.85 #> 7 Move 113. 1047. NA NA NA NA 2021-01-10 14:45:47 5.01 #> 8 Move 114. 1047. NA NA NA NA 2021-01-10 14:45:47 6.17 #> 9 Move 115. 1047. NA NA NA NA 2021-01-10 14:45:47 7.69 #> 10 Move 117. 1047. NA NA NA NA 2021-01-10 14:45:47 9.67 #> # … with 11,289 more rows