rapids/src/features/location_barnett/DistanceTravelled.R

11 lines
176 B
R
Raw Normal View History

2019-11-05 21:17:20 +01:00
DistanceTravelled <-
function(mat){
dt=0
for(i in 1:nrow(mat)){
if(mat[i,1]==1){
dt=dt+sqrt((mat[i,5]-mat[i,2])^2+(mat[i,6]-mat[i,3])^2)
}
}
return(dt)
}