Exploring patterns with latitude/ longitude co-ordinates not from GPS?!

Hey there,

Hoping someone can help please.

I am trying to analyse the movement patterns of a group of animals. Ideally, I would like to know the distance traveled in each period (a total of 3 periods and many data points/ days per period), the variability in the cluster patterns (i.e. moving around a lot or staying in one place), and which location was the most common. The data I have is from grid points on a map recorded every 5 minutes, and I have converted each grid square code (e.g. A1) into a corresponding latitude/ longitude co-ordinate. I have also added the date and time, and ID as the name of the period.
Some sample data is below:

longitude latitude datetime id
23.273798 -34.035352 2020-02-03 08:30:00 Pre
23.273798 -34.035352 2020-02-03 08:35:00 Pre
23.273798 -34.035352 2020-02-03 08:40:00 Pre
23.274721 -34.035388 2020-02-03 08:45:00 Pre
23.274721 -34.035388 2020-02-03 08:50:00 Pre
23.274721 -34.035388 2020-02-03 08:55:00 Pre
23.274818 -34.036117 2020-02-03 09:00:00 Pre
23.274818 -34.036117 2020-02-03 09:05:00 Pre
23.274818 -34.036117 2020-02-03 09:10:00 Pre
23.274818 -34.036117 2020-02-03 09:15:00 Pre
23.274818 -34.036117 2020-02-03 09:20:00 Pre
23.274818 -34.036117 2020-02-03 09:25:00 Pre
23.273766 -34.038561 2020-02-03 09:30:00 Pre
23.273766 -34.038561 2020-02-03 09:35:00 Pre
23.273766 -34.038561 2020-02-03 09:40:00 Pre
23.273766 -34.038561 2020-02-03 09:45:00 Pre
23.273787 -34.037691 2020-02-03 09:50:00 Pre
23.273766 -34.038561 2020-02-03 09:55:00 Pre
23.272833 -34.038562 2020-02-03 10:00:00 Pre
23.272833 -34.038562 2020-02-03 10:05:00 Pre
23.273766 -34.038561 2020-02-03 10:10:00 Pre
23.273787 -34.037691 2020-02-03 10:15:00 Pre
23.272833 -34.038562 2020-02-03 10:20:00 Pre
23.273766 -34.038561 2020-02-03 10:25:00 Pre
23.273766 -34.038561 2020-02-03 10:30:00 Pre
23.273766 -34.038561 2020-02-03 10:35:00 Pre
23.273766 -34.038561 2020-02-03 10:40:00 Pre
23.273787 -34.037691 2020-02-03 10:45:00 Pre
23.272833 -34.038562 2020-02-03 10:50:00 Pre

I have tried analyzing in RStudio as it is, using numerous different methods and packages (e.g. stmove, move, rgdal, moveHMM, sp, raster etc. I have followed tutorials online, read around the subject, imported the csv file into QGIS and exported back out. Nothing seems to work. I have set the CRS as WGS84, have told R what the co-ordinates are, everything I can think of. But every time I try a method I get a new type of error.

Example:
Error in adehabitatLT::setNA(traj, date.ref = ref, dt = dt, units = units) :
ltraj should be of type II (time recorded)

If I use POSIX to reformat the date/ time, it turns the whole column into NAs.

My question is... is it even possible to analyse telemetry data that hasn't come from GPS? Or is there some really simple formatting problem that I just haven't fixed yet?

Many thanks in advance!

Can you provide a dataframe so that we can paste in in Rstudio, for example dput(head(yourdataframe, 20)).
Then can you paste the code that generates the error?

Hi, welcome to the forum.

Thanks for the data but couuld I ask that you supply it using dput()? This will give us an exact copy of your data. As it is, we do not know enough about its structure to eve make an educated guess if datetime is a character or time variable, and so on.

It would help if you showed the code you have been using so far.

See FAQ: Tips for writing R-related questions for some general suggestions or FAQ: How to do a minimal reproducible example ( reprex ) for beginners

Hey Flm and jrkrideau,

Thanks so much for your replies. I have made a bit more progress since my first post, but I am still not managing to succeed. I will post all code used in this latest method. For ease, I have reformatted the datetime column and have renamed columns to fit the tutorial I have been following.

Here is the data frame:
structure(list(Longitude = c(23.273798, 23.273798, 23.273798,
23.274721, 23.274721, 23.274721, 23.274818, 23.274818, 23.274818,
23.274818, 23.274818, 23.274818, 23.273766, 23.273766, 23.273766,
23.273766, 23.273787, 23.273766, 23.272833, 23.272833), Latitude = c(-34.035352,
-34.035352, -34.035352, -34.035388, -34.035388, -34.035388, -34.036117,
-34.036117, -34.036117, -34.036117, -34.036117, -34.036117, -34.038561,
-34.038561, -34.038561, -34.038561, -34.037691, -34.038561, -34.038562,
-34.038562), Time = structure(c(1583137800, 1583138100, 1583138400,
1583138700, 1583139000, 1583139300, 1583139600, 1583139900, 1583140200,
1583140500, 1583140800, 1583141100, 1583141400, 1583141700, 1583142000,
1583142300, 1583142600, 1583142900, 1583143200, 1583143500), class = c("POSIXct",
"POSIXt"), tzone = "UTC"), Herd = c("Pre", "Pre", "Pre", "Pre",
"Pre", "Pre", "Pre", "Pre", "Pre", "Pre", "Pre", "Pre", "Pre",
"Pre", "Pre", "Pre", "Pre", "Pre", "Pre", "Pre"), ID = 1:20,
X = c(19005904.835773, 19005904.835773, 19005904.835773,
19005851.64108, 19005851.64108, 19005851.64108, 19006097.6250832,
19006097.6250832, 19006097.6250832, 19006097.6250832, 19006097.6250832,
19006097.6250832, 19007020.3460048, 19007020.3460048, 19007020.3460048,
19007020.3460048, 19006717.0295294, 19007020.3460048, 19007087.0873124,
19007087.0873124), Y = c(10533131.9385612, 10533131.9385612,
10533131.9385612, 10533401.5758544, 10533401.5758544, 10533401.5758544,
10533491.9050809, 10533491.9050809, 10533491.9050809, 10533491.9050809,
10533491.9050809, 10533491.9050809, 10533396.998876, 10533396.998876,
10533396.998876, 10533396.998876, 10533328.6946106, 10533396.998876,
10533127.6196109, 10533127.6196109), Year = c(2020, 2020,
2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020,
2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020), DOY = c(62,
62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62,
62, 62, 62, 62)), projection = "+proj=utm +zone=11 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs", row.names = c(NA,
20L), class = "data.frame")

The code I have used so far:
caribou.raw <- read.csv("./caribou.csv")
dim(caribou.raw)
names(caribou.raw)
head(caribou.raw)
str(caribou.raw)
caribou.raw$Herd<-as.factor(caribou.raw$Herd)
caribou.raw$Location.Date<-as.factor(caribou.raw$Location.Date)
caribou.raw$ID<-as.factor(caribou.raw$ID)
levels(caribou.raw$Herd)
caribou <- rename(caribou.raw, c(ID = "ID", Location.Date = "Time"))
table(caribou$Herd)
with(subset(caribou, Herd == "Pre"), plot(Longitude, Latitude, col = "blue"))
with(subset(caribou, Herd == "During"), points(Longitude, Latitude, col = "red"))
head(as.POSIXlt(caribou$Time, format = "%m/%d/%Y %H:%M", tz = "UTC"))
require(lubridate)
caribou$Time <- mdy_hm(caribou$Time)

last line fails to parse, but POSIX line seems to work.

range(caribou$Time) ## produces NAs
hour(caribou$Time)[1:10]
month(caribou$Time)[1:10]
yday(caribou$Time)[1:10]
caribou$Time[1:10]
diff(caribou$Time[1:10])

##to visualise
require(PBSmapping)
ll <- with(caribou, data.frame(X = Longitude, Y = Latitude))
attributes(ll)$projection <- "LL"
xy <- convUL(ll, km=TRUE)
caribou <- cbind(caribou, xy)
palette(rainbow(10))
with(subset(caribou, Herd == "Pre"),
plot(X,Y, asp=1, col = ID, pch = 19, cex= 0.5, main = "Pre - UTM"))
diff(range(xy$X))
diff(range(xy$Y))
ddply(caribou, "Herd", summarize,
n.loc = length(X),
n.ind = length(unique(ID)),
time.range = diff(range(Time)),
x.range.km = diff(range(X)), y.range.km = diff(range(Y)))
require(rgdal)

NWT.proj4 <- "+proj=lcc +lat_1=50 +lat_2=70 +lat_0=40 +lon_0=-96 +x_0=0 +y_0=0 +datum=NAD83 +units=m +no_defs"

XY <- project(cbind(caribou$Longitude, caribou$Latitude), NWT.proj4)
caribou$X <- XY[,1]
caribou$Y <- XY[,2]

with(subset(caribou, Herd == "Pre"),
plot(X,Y, asp=1, col = ID, cex= 0.5, pch = 19,
main = "PRE: KPA"))

##produces NAs in seconds
ddply(caribou, "Herd", summarize, duration = diff(range(Time)))

#as a function
processCaribou <- function(caribou.raw, projection){
caribou <- rename(caribou.raw, c(ID = "ID", Location.Date = "Time"))
caribou$Time <- mdy_hm(caribou$Time)

caribou$X <- XY[,1]
caribou$Y <- XY[,2]

this line attached the projection as an "attribute" of the data

attributes(caribou) <- c(attributes(caribou), projection = projection)
return(caribou)
}

UTM11.proj <- "+proj=utm +zone=11 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs"

caribou <- processCaribou(caribou.raw, UTM11.proj)
with(caribou,
plot(X/1000, Y/1000, col = alpha(as.integer(Herd), .2),
pch = 19, cex = 0.3, asp = 1, main = "All caribou"))
##produces error message: Warning message:
In alpha(as.integer(Herd), 0.2) : NAs introduced by coercion

##analysis part
caribou <- mutate(caribou, Year = year(Time), DOY = yday(Time))
caribou.daily <- ddply(caribou, c("ID", "Year", "DOY", "Herd", "ID"),
summarize, Latitude = mean(Latitude), Longitude = mean(Longitude), X = mean(X),
Y = mean(Y))
dim(caribou)
dim(caribou.daily)
head(caribou.daily)

caribou.daily <- mutate(caribou.daily, Date = ymd(paste(Year - 1, 12, 31)) +
ddays(DOY), Month = month(Date)) ##FAILS TO PARSE

attr(caribou.daily, "projection") <- attr(caribou, "projection")

pp5 <- subset(caribou.daily, Herd == "Pre")
Z <- pp5$X + (0+1i) * pp5$Y
StepLength <- Mod(diff(Z))
dT <- as.numeric(diff(pp5$Date))
table(dT)
Speed <- StepLength/dT
hist(Speed/1000, breaks = 50, col = "grey")
summary(Speed/1000) ## PRODUCES TABLE WITH “inf” and NAs

##none of the following works
computeDD <- function(data) {
Z <- data$X + (0+1i) * data$Y
StepLength <- c(NA, Mod(diff(Z)))
dT <- c(NA, as.numeric(diff(data$Date)))
Speed <- StepLength/dT
return(data.frame(data, StepLength, dT, Speed))
}
caribou.daily <- ddply(caribou.daily, "Herd", computeDD)
summary(caribou.daily)

boxplot((Speed/1000) ~ Month, data = subset(caribou.daily, Speed > 0), log = "y",
ylim = c(0.001, 100), ylab = "km/day", pch = 19, cex = 0.5, col = rgb(0,

Next I would like to calculate movement rates, home ranges and utilisation distributions, kernel density estimates, and eventually do mixed effects models between the three periods (pre, during, post), but I don't seem to get the data into the correct format to begin with, and then I get really lost making the rest of it work. I really really appreciate your advice. I'm sure there is a simpler way to do all of this to, but it is fairly new to me.

Thank you so much for your help!

Hi @Pman,
It looks like you are tying yourself in knots with changing the Time variable but it is fine as-is.
I have commented out many non-essential lines in the following code.
This is the exact opposite of a minimal reproducible example!!
Also, you are using functions from both the dplyr and plyr packages - this can cause conflicts.

suppressPackageStartupMessages(library(tidyverse))
library(lubridate)
#> 
#> Attaching package: 'lubridate'
#> The following objects are masked from 'package:base':
#> 
#>     date, intersect, setdiff, union
library(PBSmapping)
#> 
#> -----------------------------------------------------------
#> PBS Mapping 2.73.2 -- Copyright (C) 2003-2022 Fisheries and Oceans Canada
#> 
#> PBS Mapping comes with ABSOLUTELY NO WARRANTY;
#> for details see the file COPYING.
#> This is free software, and you are welcome to redistribute
#> it under certain conditions, as outlined in the above file.
#> 
#> A complete user guide 'PBSmapping-UG.pdf' is located at 
#> C:/Users/david/AppData/Local/R/win-library/4.2/PBSmapping/doc/PBSmapping-UG.pdf
#> 
#> Packaged on 2022-09-06
#> Pacific Biological Station, Nanaimo
#> 
#> All available PBS packages can be found at
#> https://github.com/pbs-software
#> 
#> To see demos, type '.PBSfigs()'.
#> -----------------------------------------------------------
library(rgdal)
#> Loading required package: sp
#> Please note that rgdal will be retired by the end of 2023,
#> plan transition to sf/stars/terra functions using GDAL and PROJ
#> at your earliest convenience.
#> 
#> rgdal: version: 1.5-32, (SVN revision 1176)
#> Geospatial Data Abstraction Library extensions to R successfully loaded
#> Loaded GDAL runtime: GDAL 3.4.3, released 2022/04/22
#> Path to GDAL shared files: C:/Users/david/AppData/Local/R/win-library/4.2/rgdal/gdal
#> GDAL binary built with GEOS: TRUE 
#> Loaded PROJ runtime: Rel. 7.2.1, January 1st, 2021, [PJ_VERSION: 721]
#> Path to PROJ shared files: C:/Users/david/AppData/Local/R/win-library/4.2/rgdal/proj
#> PROJ CDN enabled: FALSE
#> Linking to sp version:1.5-0
#> To mute warnings of possible GDAL/OSR exportToProj4() degradation,
#> use options("rgdal_show_exportToProj4_warnings"="none") before loading sp or rgdal.
library(plyr)
#> ------------------------------------------------------------------------------
#> You have loaded plyr after dplyr - this is likely to cause problems.
#> If you need functions from both plyr and dplyr, please load plyr first, then dplyr:
#> library(plyr); library(dplyr)
#> ------------------------------------------------------------------------------
#> 
#> Attaching package: 'plyr'
#> The following objects are masked from 'package:dplyr':
#> 
#>     arrange, count, desc, failwith, id, mutate, rename, summarise,
#>     summarize
#> The following object is masked from 'package:purrr':
#> 
#>     compact

caribou.raw <- structure(list(Longitude = c(23.273798, 23.273798, 23.273798,
23.274721, 23.274721, 23.274721, 23.274818, 23.274818, 23.274818,
23.274818, 23.274818, 23.274818, 23.273766, 23.273766, 23.273766,
23.273766, 23.273787, 23.273766, 23.272833, 23.272833), Latitude = c(-34.035352,
-34.035352, -34.035352, -34.035388, -34.035388, -34.035388, -34.036117,
-34.036117, -34.036117, -34.036117, -34.036117, -34.036117, -34.038561,
-34.038561, -34.038561, -34.038561, -34.037691, -34.038561, -34.038562,
-34.038562), Time = structure(c(1583137800, 1583138100, 1583138400,
1583138700, 1583139000, 1583139300, 1583139600, 1583139900, 1583140200,
1583140500, 1583140800, 1583141100, 1583141400, 1583141700, 1583142000,
1583142300, 1583142600, 1583142900, 1583143200, 1583143500), class = c("POSIXct",
"POSIXt"), tzone = "UTC"), Herd = c("Pre", "Pre", "Pre", "Pre",
"Pre", "Pre", "Pre", "Pre", "Pre", "Pre", "Pre", "Pre", "Pre",
"Pre", "Pre", "Pre", "Pre", "Pre", "Pre", "Pre"), ID = 1:20,
X = c(19005904.835773, 19005904.835773, 19005904.835773,
19005851.64108, 19005851.64108, 19005851.64108, 19006097.6250832,
19006097.6250832, 19006097.6250832, 19006097.6250832, 19006097.6250832,
19006097.6250832, 19007020.3460048, 19007020.3460048, 19007020.3460048,
19007020.3460048, 19006717.0295294, 19007020.3460048, 19007087.0873124,
19007087.0873124), Y = c(10533131.9385612, 10533131.9385612,
10533131.9385612, 10533401.5758544, 10533401.5758544, 10533401.5758544,
10533491.9050809, 10533491.9050809, 10533491.9050809, 10533491.9050809,
10533491.9050809, 10533491.9050809, 10533396.998876, 10533396.998876,
10533396.998876, 10533396.998876, 10533328.6946106, 10533396.998876,
10533127.6196109, 10533127.6196109), Year = c(2020, 2020,
2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020,
2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020), DOY = c(62,
62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62,
62, 62, 62, 62)), projection = "+proj=utm +zone=11 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs", row.names = c(NA,
20L), class = "data.frame")

#caribou.raw <- read.csv("./caribou.csv")
#dim(caribou.raw)
#names(caribou.raw)
#head(caribou.raw)
#str(caribou.raw)
caribou.raw$Herd <- as.factor(caribou.raw$Herd)
caribou.raw$Location.Date <- as.factor(caribou.raw$Location.Date)
#> Error in `$<-.data.frame`(`*tmp*`, Location.Date, value = structure(integer(0), levels = character(0), class = "factor")): replacement has 0 rows, data has 20
caribou.raw$ID <- as.factor(caribou.raw$ID)
levels(caribou.raw$Herd)
#> [1] "Pre"
caribou <- rename(caribou.raw, c(ID = "ID", Location.Date = "Time"))
#> The following `from` values were not present in `x`: Location.Date
str(caribou)
#> 'data.frame':    20 obs. of  9 variables:
#>  $ Longitude: num  23.3 23.3 23.3 23.3 23.3 ...
#>  $ Latitude : num  -34 -34 -34 -34 -34 ...
#>  $ Time     : POSIXct, format: "2020-03-02 08:30:00" "2020-03-02 08:35:00" ...
#>  $ Herd     : Factor w/ 1 level "Pre": 1 1 1 1 1 1 1 1 1 1 ...
#>  $ ID       : Factor w/ 20 levels "1","2","3","4",..: 1 2 3 4 5 6 7 8 9 10 ...
#>  $ X        : num  1.9e+07 1.9e+07 1.9e+07 1.9e+07 1.9e+07 ...
#>  $ Y        : num  10533132 10533132 10533132 10533402 10533402 ...
#>  $ Year     : num  2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 ...
#>  $ DOY      : num  62 62 62 62 62 62 62 62 62 62 ...
#>  - attr(*, "projection")= chr "+proj=utm +zone=11 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs"
table(caribou$Herd)
#> 
#> Pre 
#>  20
#with(subset(caribou, Herd == "Pre"), plot(Longitude, Latitude, col = "blue"))
#with(subset(caribou, Herd == "During"), points(Longitude, Latitude, col = "red"))
#head(as.POSIXlt(caribou$Time, format = "%m/%d/%Y %H:%M", tz = "UTC"))

#caribou$Time <- mdy_hm(caribou$Time)


# range(caribou$Time) ## produces NAs
# hour(caribou$Time)
# month(caribou$Time)
# yday(caribou$Time)
# caribou$Time[1:10]
# diff(caribou$Time[1:10])

##to visualise
ll <- with(caribou, data.frame(X = Longitude, Y = Latitude))
attributes(ll)$projection <- "LL"
xy <- convUL(ll, km=TRUE)
#> convUL: For the UTM conversion, automatically detected zone 34.
#> convUL: Converting coordinates within the southern hemisphere.
caribou <- cbind(caribou, xy)
palette(rainbow(10))
#with(subset(caribou, Herd == "Pre"),
plot(caribou$X, caribou$Y, asp=1, col=caribou$ID, pch=19, cex=1, main="Pre - UTM")


diff(range(xy$X))
#> [1] 0.1893115
diff(range(xy$Y))
#> [1] 0.3558495
ddply(caribou, "Herd", summarize,
      n.loc = length(X),
      n.ind = length(unique(ID)),
      time.range = diff(range(Time)),
      x.range.km = diff(range(X)), y.range.km = diff(range(Y)))
#>   Herd n.loc n.ind     time.range x.range.km y.range.km
#> 1  Pre    20    20 1.583333 hours   1235.446   364.2855


NWT.proj4 <- "+proj=lcc +lat_1=50 +lat_2=70 +lat_0=40 +lon_0=-96 +x_0=0 +y_0=0 +datum=NAD83 +units=m +no_defs"

XY <- project(cbind(caribou$Longitude, caribou$Latitude), NWT.proj4)
caribou$X <- XY[,1]
caribou$Y <- XY[,2]

#with(subset(caribou, Herd == "Pre"),
plot(caribou$X, caribou$Y, asp=1, col=caribou$ID, cex=1, pch=19, main="PRE: KPA")


ddply(caribou, "Herd", summarize, duration = diff(range(Time)))
#>   Herd       duration
#> 1  Pre 1.583333 hours
#as a function
# processCaribou <- function(caribou.raw, projection){
#   caribou <- rename(caribou.raw, c(ID = "ID", Location.Date = "Time"))
#   caribou$Time <- mdy_hm(caribou$Time)
# 
#   caribou$X <- XY[,1]
#   caribou$Y <- XY[,2]
# 
#   #this line attached the projection as an "attribute" of the data
#   attributes(caribou) <- c(attributes(caribou), projection = projection)
#   return(caribou)
# }
# 
# UTM11.proj <- "+proj=utm +zone=11 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs"
# 
# caribou <- processCaribou(caribou.raw, UTM11.proj)
# with(caribou,
# plot(X/1000, Y/1000, col = alpha(as.integer(Herd), .2),
# pch = 19, cex = 0.3, asp = 1, main = "All caribou"))
# ##produces error message: Warning message:
# In alpha(as.integer(Herd), 0.2) : NAs introduced by coercion
caribou <- mutate(caribou, Year = year(Time), DOY = yday(Time))
caribou.daily <- ddply(caribou, c("ID", "Year", "DOY", "Herd", "ID"),
                       summarize, 
                       Latitude = mean(Latitude), 
                       Longitude = mean(Longitude), 
                       X = mean(X),
Y = mean(Y))
dim(caribou)
#> [1] 20 11
dim(caribou.daily)
#> [1] 20  8
head(caribou.daily)
#>   ID Year DOY Herd  Latitude Longitude        X        Y
#> 1  1 2020  62  Pre -34.03535  23.27380 19005905 10533132
#> 2  2 2020  62  Pre -34.03535  23.27380 19005905 10533132
#> 3  3 2020  62  Pre -34.03535  23.27380 19005905 10533132
#> 4  4 2020  62  Pre -34.03539  23.27472 19005852 10533402
#> 5  5 2020  62  Pre -34.03539  23.27472 19005852 10533402
#> 6  6 2020  62  Pre -34.03539  23.27472 19005852 10533402

caribou.daily <- mutate(caribou.daily, Date = ymd(paste(Year - 1, 12, 31)) +
ddays(DOY), Month = month(Date)) ##FAILS TO PARSE

attr(caribou.daily, "projection") <- attr(caribou, "projection")

pp5 <- subset(caribou.daily, Herd == "Pre")
Z <- pp5$X + (0+1i) * pp5$Y
StepLength <- Mod(diff(Z))
StepLength  # Working up to here
#>  [1]   0.0000   0.0000 274.8344   0.0000   0.0000 262.0448   0.0000   0.0000
#>  [9]   0.0000   0.0000   0.0000 927.5889   0.0000   0.0000   0.0000 310.9121
#> [17] 310.9121 277.5240   0.0000
dT <- as.numeric(diff(pp5$Date))  # Subset of data here is all the same Day-of-year
table(dT)
#> dT
#>  0 
#> 19
Speed <- StepLength/dT
hist(Speed/1000, breaks = 50, col = "grey")
#> Warning in min(x): no non-missing arguments to min; returning Inf
#> Warning in max(x): no non-missing arguments to max; returning -Inf
#> Error in hist.default(Speed/1000, breaks = 50, col = "grey"): character(0)
summary(Speed/1000) ## PRODUCES TABLE WITH “inf” and NAs
#>    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
#>     Inf     Inf     Inf     Inf     Inf     Inf      13

Created on 2022-11-07 with reprex v2.0.2

Hello,

Thank you so much for your reply and help on this! So sorry I put too much, I wasn't sure how much code was needed but I will know for next time. I really appreciate your time thank you :slight_smile: I will have a look at this later today.

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.