trajectory analysis

If I understand you correctly, this would give you instant velocity on each "frame" (I'm not sure what you mean with this), following the same logic you can calculate the variation of speed over time (acceleration).

library(dplyr)

sample_df <- data.frame(
    x = c(47.7241,47.6629,47.6016,47.1948,46.7879,
          46.3811,45.9742,45.5674,45.1605,44.7537,44.3468,43.9399,
          43.5331,43.1262,42.7194,42.3125,41.9057,41.4988,41.092,
          40.6851,40.2783,39.8714,39.4646,39.0577,38.6509,38.244,
          37.8372,37.4303,37.0234,36.6166,36.2097,35.8029,35.396,
          34.9892,34.5823,34.3687,34.155,33.9414,33.7277,33.5141,
          33.3004,33.0868,32.8731,32.6595,32.4458,32.2322,32.0185,
          31.8049,31.5912,31.3776,31.1639,30.9503,30.7366,30.523,
          30.3093,30.0957,29.882,29.6684,29.4547,29.2411,29.0274,
          28.8137,28.6001,28.3864,28.1728,27.9591,27.7455,27.5318,
          27.3182,27.1045,26.8909,26.6772,26.4636,26.2499,26.0363,
          25.8226,25.609,25.3953,25.1817,24.968,24.7544,24.5407,
          24.3271,24.1134,23.8998,23.6861,23.4725,23.2588,23.0368,
          22.8147,22.5926,22.3706,22.1485,21.9264,21.7044,21.4823,
          21.2602,21.0382,20.8161,20.594,20.372,20.1499,19.9278,19.7058,
          19.4837,19.2617,19.0396,18.8175,18.5955,18.3734,18.1513,
          17.9293,17.7072,17.4851,17.2631,17.041,16.8189,16.5969,
          16.3748,16.1527,15.9307,15.7086,15.4865,15.2645,15.0424,
          14.8203,14.5983,14.3762,14.1541,13.9321,13.71,13.488,
          13.2659,13.0438,12.8218,12.5997,12.3776,12.1556,11.9335,
          11.7114,11.4894,11.2673,11.0452,10.8232,10.6011,10.379,
          10.157,9.9349,9.7128,9.4908,9.2687,9.0466,8.6554,8.2642,
          7.873,7.4818,7.0906,6.6994,6.3082,5.917),
    y = c(26.2659,26.0827,25.8996,25.6156,25.3316,
          25.0476,24.7636,24.4796,24.1957,23.9117,23.6277,23.3437,
          23.0597,22.7758,22.4918,22.2078,21.9238,21.6398,21.3558,
          21.0719,20.7879,20.5039,20.2199,19.9359,19.652,19.368,
          19.084,18.8,18.516,18.232,17.9481,17.6641,17.3801,
          17.0961,16.8121,16.6736,16.535,16.3965,16.2579,16.1193,15.9808,
          15.8422,15.7037,15.5651,15.4265,15.288,15.1494,15.0109,
          14.8723,14.7338,14.5952,14.4566,14.3181,14.1795,14.041,
          13.9024,13.7638,13.6253,13.4867,13.3482,13.2096,13.071,
          12.9325,12.7939,12.6554,12.5168,12.3783,12.2397,12.1011,
          11.9626,11.824,11.6855,11.5469,11.4083,11.2698,11.1312,
          10.9927,10.8541,10.7155,10.577,10.4384,10.2999,10.1613,
          10.0228,9.8842,9.7456,9.6071,9.4685,9.576,9.6835,9.791,
          9.8984,10.0059,10.1134,10.2209,10.3284,10.4358,10.5433,
          10.6508,10.7583,10.8657,10.9732,11.0807,11.1882,11.2957,
          11.4031,11.5106,11.6181,11.7256,11.8331,11.9405,12.048,
          12.1555,12.263,12.3705,12.4779,12.5854,12.6929,12.8004,
          12.9079,13.0153,13.1228,13.2303,13.3378,13.4452,13.5527,
          13.6602,13.7677,13.8752,13.9826,14.0901,14.1976,14.3051,
          14.4126,14.52,14.6275,14.735,14.8425,14.95,15.0574,15.1649,
          15.2724,15.3799,15.4874,15.5948,15.7023,15.8098,15.9173,
          16.0247,16.1322,16.2397,16.3472,17.1089,17.8707,18.6324,
          19.3942,20.1559,20.9177,21.6794,22.4412)
)

sample_df %>% 
    mutate(vel = sqrt((lag(x) - x) ^ 2 + (lag(y) - y) ^ 2) / (1/30)) %>% 
    as_tibble() # Just for friendly printing
#> # A tibble: 160 x 3
#>        x     y   vel
#>    <dbl> <dbl> <dbl>
#>  1  47.7  26.3 NA   
#>  2  47.7  26.1  5.79
#>  3  47.6  25.9  5.79
#>  4  47.2  25.6 14.9 
#>  5  46.8  25.3 14.9 
#>  6  46.4  25.0 14.9 
#>  7  46.0  24.8 14.9 
#>  8  45.6  24.5 14.9 
#>  9  45.2  24.2 14.9 
#> 10  44.8  23.9 14.9 
#> # … with 150 more rows

Created on 2020-03-26 by the reprex package (v0.3.0.9001)

For future posts, please provide a proper REPRoducible EXample (reprex) illustrating your issue.

1 Like