YuriNiella / RSP

Refining the Shortest Paths (RSP) of animals tracked with acoustic transmitters in estuarine regions
GNU General Public License v3.0
14 stars 4 forks source link

runRSP:Error in if (is.numeric(v) && any(v < 0)) { : missing value where TRUE/FALSE needed #17

Closed JonnyArcher closed 3 years ago

JonnyArcher commented 4 years ago

Trying to use RSP and running the following code and getting this rsp.results <- runRSP(input = filtered_data, t.layer = water.transition, coord.x = "Longitude", coord.y = "Latitude")

M: Calculating RSP for the 'explore' data compiled on 2020-10-28 17:16:01 |====== | 11%Error in if (is.numeric(v) && any(v < 0)) { : missing value where TRUE/FALSE needed In addition: There were 27 warnings (use warnings() to see them) Timing stopped at: 4.032 0.953 5.039

warnings() Warning messages: 1: In SpatialPointsDataFrame(spp, data.frame(Lines.NR = L3, ... : If the coords argument is a SpatialPoints object, set its CRS first; the proj4string argument to this function is ignored. 2: In SpatialPointsDataFrame(spp, data.frame(Lines.NR = L3, ... : If the coords argument is a SpatialPoints object, set its CRS first; the proj4string argument to this function is ignored. 3: In SpatialPointsDataFrame(spp, data.frame(Lines.NR = L3, ... : If the coords argument is a SpatialPoints object, set its CRS first; the proj4string argument to this function is ignored. 4: In SpatialPointsDataFrame(spp, data.frame(Lines.NR = L3, ... : If the coords argument is a SpatialPoints object, set its CRS first; the proj4string argument to this function is ignored. 5: In SpatialPointsDataFrame(spp, data.frame(Lines.NR = L3, ... : If the coords argument is a SpatialPoints object, set its CRS first; the proj4string argument to this function is ignored. 6: In SpatialPointsDataFrame(spp, data.frame(Lines.NR = L3, ... : If the coords argument is a SpatialPoints object, set its CRS first; the proj4string argument to this function is ignored. 7: In SpatialPointsDataFrame(spp, data.frame(Lines.NR = L3, ... : If the coords argument is a SpatialPoints object, set its CRS first; the proj4string argument to this function is ignored. 8: In SpatialPointsDataFrame(spp, data.frame(Lines.NR = L3, ... : If the coords argument is a SpatialPoints object, set its CRS first; the proj4string argument to this function is ignored. 9: In SpatialPointsDataFrame(spp, data.frame(Lines.NR = L3, ... : If the coords argument is a SpatialPoints object, set its CRS first; the proj4string argument to this function is ignored. 10: In SpatialPointsDataFrame(spp, data.frame(Lines.NR = L3, ... : If the coords argument is a SpatialPoints object, set its CRS first; the proj4string argument to this function is ignored. 11: In SpatialPointsDataFrame(spp, data.frame(Lines.NR = L3, ... : If the coords argument is a SpatialPoints object, set its CRS first; the proj4string argument to this function is ignored. 12: In SpatialPointsDataFrame(spp, data.frame(Lines.NR = L3, ... : If the coords argument is a SpatialPoints object, set its CRS first; the proj4string argument to this function is ignored. 13: In SpatialPointsDataFrame(spp, data.frame(Lines.NR = L3, ... : If the coords argument is a SpatialPoints object, set its CRS first; the proj4string argument to this function is ignored. 14: In SpatialPointsDataFrame(spp, data.frame(Lines.NR = L3, ... : If the coords argument is a SpatialPoints object, set its CRS first; the proj4string argument to this function is ignored. 15: In SpatialPointsDataFrame(spp, data.frame(Lines.NR = L3, ... : If the coords argument is a SpatialPoints object, set its CRS first; the proj4string argument to this function is ignored. 16: In SpatialPointsDataFrame(spp, data.frame(Lines.NR = L3, ... : If the coords argument is a SpatialPoints object, set its CRS first; the proj4string argument to this function is ignored. 17: In SpatialPointsDataFrame(spp, data.frame(Lines.NR = L3, ... : If the coords argument is a SpatialPoints object, set its CRS first; the proj4string argument to this function is ignored. 18: In SpatialPointsDataFrame(spp, data.frame(Lines.NR = L3, ... : If the coords argument is a SpatialPoints object, set its CRS first; the proj4string argument to this function is ignored. 19: In SpatialPointsDataFrame(spp, data.frame(Lines.NR = L3, ... : If the coords argument is a SpatialPoints object, set its CRS first; the proj4string argument to this function is ignored. 20: In SpatialPointsDataFrame(spp, data.frame(Lines.NR = L3, ... : If the coords argument is a SpatialPoints object, set its CRS first; the proj4string argument to this function is ignored. 21: In get.shortest.paths(adjacencyGraph, indexOrigin, indexGoal) : At structural_properties.c:4597 :Couldn't reach some vertices 22: In SpatialPointsDataFrame(spp, data.frame(Lines.NR = L3, ... : If the coords argument is a SpatialPoints object, set its CRS first; the proj4string argument to this function is ignored. 23: In SpatialPointsDataFrame(spp, data.frame(Lines.NR = L3, ... : If the coords argument is a SpatialPoints object, set its CRS first; the proj4string argument to this function is ignored. 24: In SpatialPointsDataFrame(spp, data.frame(Lines.NR = L3, ... : If the coords argument is a SpatialPoints object, set its CRS first; the proj4string argument to this function is ignored. 25: In SpatialPointsDataFrame(spp, data.frame(Lines.NR = L3, ... : If the coords argument is a SpatialPoints object, set its CRS first; the proj4string argument to this function is ignored. 26: In SpatialPointsDataFrame(spp, data.frame(Lines.NR = L3, ... : If the coords argument is a SpatialPoints object, set its CRS first; the proj4string argument to this function is ignored. 27: In SpatialPointsDataFrame(spp, data.frame(Lines.NR = L3, ... : If the coords argument is a SpatialPoints object, set its CRS first; the proj4string argument to this function is ignored.

YuriNiella commented 4 years ago

Hey @JonnyArcher , There seems to be a problem with the base shapefile Coordinate Reference System (CRS) you are providing to RSP. It seems like you are using a longlat projection, so you might need to check that your shapefile CRS is set to a WGS 84 projection: "+proj=longlat +datum=WGS84 +no_defs"

JonnyArcher commented 4 years ago

Hi Yuri

I have added my script to the bottom to see if its something stupid im doing….

I have my polygon exported in EPSG:4326 WGS 84 coordinate system. Which has worked with actels code for creating a distance matrics

Also Im unsure if I should enter this code "+proj=longlat +datum=WGS84 +no_defs" into my code as such?:

rsp.results <- runRSP(input = filtered_data, t.layer = water.transition, coord.x = "Longitude", coord.y = "Latitude","+proj=longlat +datum=WGS84 +no_defs")

if so I get this message

rsp.results <- runRSP(input = filtered_data, t.layer = water.transition, coord.x = "Longitude", coord.y = "Latitude","+proj=longlat +datum=WGS84 +no_defs") Error in distance * 0.05 : non-numeric argument to binary operator In addition: Warning message: Unknown or uninitialised column: Receiver.

Im also getting this error message

plotRaster(input = water.transition, base.raster = water.shape, coord.x = "Longitude", coord.y = "Latitude") Error: Could not recognise the station data as a data frame.

But im finding

raster::plot(water.shape)

works fine

MY full script

Actel Trout 2018

Jonny Archer

26th Aug 2020

Must have Libraries

library(tidyverse) library(plyr) library(lubridate)#True

library(actel)#True

to download latest actel

remotes::install_github("hugomflavio/actel", build_opts = c("--no-resave-data", "--no-manual"), build_vignettes = TRUE)

Debug Line for hugo

options(actel.debug = FALSE)

Optional packages For actel

library(digest)#False

library(memoise)#False

library(gWidgets2)#True

library(RGtk2)#False

library(gWidgets2RGtk2)#False

library(sp)#False

library(raster)#False

library(Matrix)#False

library(igraph)#False

library(gdistance)#False

library(tools)#False

library(rgdal)#False

library(testthat)#False

library(knitr)#False

library(remotes)#False

Clear Brains but doesn't clear libraries

rm(list = ls())

Needed for actel

setwd("~/Desktop/OneDrive - University of Glasgow/Project 1 Sea trout/Created Docs/Actel_2018_wd")

Files

Biometrics

biometrics <- read_csv("~/Desktop/OneDrive - University of Glasgow/Project 1 Sea trout/Created Docs/Actel_2018_wd/biometrics_2018.csv", col_types = cols(Release.date = col_datetime(format = "%d/%m/%Y %H:%M:%S"))) biometrics$Release.date <- as.POSIXct(biometrics$Release.date)

detections

detections <- read_csv("~/Desktop/OneDrive - University of Glasgow/Project 1 Sea trout/Created Docs/Actel_2018_wd/Actel_2018_filtered_1200s.csv", col_types = cols(Timestamp = col_datetime(format = "%d/%m/%Y %H:%M:%S")))

Sensor Calibration

detections_Depth<-detections %>% select (Timestamp, Receiver,Signal,Sensor.Value,Sensor.Unit,CodeSpace) %>% filter (Signal%in% c("129","131","133","135","137","139","141","143","145","147","149","151","153","155","157","159","161","163","165","167"))

detections_Depth$Sensor.Value<- detections_Depth$Sensor.Value *1.1373-((1000-1000)/100)

detections_Temp<-detections %>% select (Timestamp, Receiver,Signal,Sensor.Value,Sensor.Unit,CodeSpace) %>% filter (Signal%in% c("130","132","134","136","138","140","142","144","146","148","150","152","154","156","158","160","162","164","166","168"))

detections_Temp$Sensor.Value<- detections_Temp$Sensor.Value *0.1+0

%nin% = Negate(%in%)

detections1<-detections %>% select (Timestamp, Receiver,Signal,Sensor.Value,Sensor.Unit,CodeSpace) %>% filter (Signal%nin% c("130","132","134","136","138","140","142","144","146","148","150","152","154","156","158","160","162","164","166","168","129","131","133","135","137","139","141","143","145","147","149","151","153","155","157","159","161","163","165","167"))

detections<-rbind(detections1,detections_Depth,detections_Temp)

rm(detections1,detections_Depth,detections_Temp)

detections$Signal<- as.integer(detections$Signal) detections$Receiver<- as.integer(detections$Receiver)

filter out late detections from predated tag 143|144

tag143<-filter(detections, Signal == 144)#2018-05-21 19:38:13 tag144<-filter(detections, Signal == 143)#2018-05-22 03:47:40

negate143144<-detections%>% filter(Signal %nin% c(143,144)) unique(negate143144$Signal)

in143144<-detections%>% filter(Signal %in% c(143,144))%>% filter(Timestamp < "2018-05-22 03:42:00")

detections<-rbind(negate143144,in143144)

rm(in143144,negate143144,tag143,tag144)

Deployment

deployments <- read_csv("~/Desktop/OneDrive - University of Glasgow/Project 1 Sea trout/Created Docs/Actel_2018_wd/deployments_2018_GM.csv", col_types = cols(Start = col_datetime(format = "%d/%m/%Y %H:%M:%S"), Stop = col_datetime(format = "%d/%m/%Y %H:%M:%S"))) deployments$Start <- as.POSIXct(deployments$Start) deployments$Stop <- as.POSIXct(deployments$Stop)

Spatial

spatial <- read_csv("~/Desktop/OneDrive - University of Glasgow/Project 1 Sea trout/Created Docs/Actel_2018_wd/spatial_2018_GM.csv")

Changing arrays and sections

spatial[spatial$Array %in% c("INS", "INR","INP"), "Array"] <- "IN"

spatial[spatial$Array %in% c("OUS", "OUR","OUP"),"Array"] <- "OUT" spatial[spatial$Array %in% c("R12","H1"),"Array"] <- "E1"

spatial[spatial$Array %in% c("IN"),"Section"] <- "SEA1" spatial[spatial$Array %in% c("MIDP"),"Section"] <- "MID" spatial[spatial$Array %in% c("OUT"),"Section"] <- "SEA2" spatial[spatial$Array %in% c("E1"),"Section"] <- "ESTUARY"

Arange spatial file for sections

spatial$Section <- as.factor(spatial$Section) spatial$Section <- fct_relevel(spatial$Section, "River", "ESTUARY", "SEA1", "MID", "SEA2") spatial<-arrange(spatial,Section)

Arange spatial file for Array

spatial$Array <- as.factor(spatial$Array) spatial$Array <- fct_relevel(spatial$Array, "R1","R2","R3","R4","R5","R6","R7","R8","R9","R10","R11", "E1", "IN", "MIDP", "OUT") spatial<-arrange(spatial,Array)

spatial<-arrange(spatial,Section)#put dinnet back in its place! str(spatial) spatial<-as_tibble(spatial)

Distances

distances<-read.csv("distances.csv", row.names = 1)

Preload

x <- preload(biometrics = biometrics, spatial = spatial, deployments = deployments, detections = detections,distances = distances, tz = "Europe/London")

RSP

remotes::install_github("YuriNiella/RSP", build_opts = c("--no-resave-data", "--no-manual"), build_vignettes = TRUE)

library(RSP)

filtered_data<-explore(datapack = x, GUI = "never")

browseVignettes("RSP")

water.shape <- loadShape(shape = "poly1.shp", size = 0.001)

water.transition <- transitionLayer(water.shape, directions = 16) raster::plot(water.shape)

plotRaster(input = water.transition, base.raster = water.shape, coord.x = "Longitude", coord.y = "Latitude")

rm(%nin%)

rsp.results <- runRSP(input = filtered_data, t.layer = water.transition, coord.x = "Longitude", coord.y = "Latitude")

From: YuriNiella notifications@github.com Reply to: YuriNiella/RSP reply@reply.github.com Date: Wednesday, 28 October 2020 at 17:51 To: YuriNiella/RSP RSP@noreply.github.com Cc: "Jonathan Archer (PGR)" 2548871A@student.gla.ac.uk, Mention mention@noreply.github.com Subject: Re: [YuriNiella/RSP] runRSP:Error in if (is.numeric(v) && any(v < 0)) { : missing value where TRUE/FALSE needed (#17)

Hey @JonnyArcherhttps://github.com/JonnyArcher , There seems to be a problem with the base shapefile Coordinate Reference System (CRS) you are providing to RSP. It seems like you are using a longlat projection, so you might need to check that your shapefile CRS is set to a WGS 84 projection: "+proj=longlat +datum=WGS84 +no_defs"

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/YuriNiella/RSP/issues/17#issuecomment-718104471, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ARRSXBR3EAWGLIGCBRMPWZTSNBKYXANCNFSM4TCUT5CA.

JonnyArcher commented 4 years ago

Hi Yuiri

Found this in the obect

water.shape@crs@projargs [1] "+proj=longlat +datum=WGS84 +no_defs"

Hope that’s the right one

Regards

Jonny From: YuriNiella notifications@github.com Reply to: YuriNiella/RSP reply@reply.github.com Date: Wednesday, 28 October 2020 at 17:51 To: YuriNiella/RSP RSP@noreply.github.com Cc: "Jonathan Archer (PGR)" 2548871A@student.gla.ac.uk, Mention mention@noreply.github.com Subject: Re: [YuriNiella/RSP] runRSP:Error in if (is.numeric(v) && any(v < 0)) { : missing value where TRUE/FALSE needed (#17)

Hey @JonnyArcherhttps://github.com/JonnyArcher , There seems to be a problem with the base shapefile Coordinate Reference System (CRS) you are providing to RSP. It seems like you are using a longlat projection, so you might need to check that your shapefile CRS is set to a WGS 84 projection: "+proj=longlat +datum=WGS84 +no_defs"

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/YuriNiella/RSP/issues/17#issuecomment-718104471, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ARRSXBR3EAWGLIGCBRMPWZTSNBKYXANCNFSM4TCUT5CA.

YuriNiella commented 4 years ago

So your shapefile CRS is correct then (no need to include the CRS in the runRSP function). Because plotRaster is not working, it seems like your stations are not being given to RSP as a dataframe and that is what's crashing the code.

What happens if you run: class(filtered_data$spatial$stations) aux.station <- filtered_data$spatial$stations # Is this object returned as a dataframe of your acoustic stations?

JonnyArcher commented 4 years ago

Hi Yuri

class(filtered_data$spatial$stations) [1] "data.frame"

Yes it is.

I’ve managed to get all this running now

x <- preload(biometrics = biometrics, spatial = spatial, deployments = deployments,

detections = detections,distances = distances, tz = "Europe/London")

filtered_data<-explore(datapack = x, GUI = "never")

water.shape <- actel::loadShape(shape = "poly1.shp", size = 0.0001)

plotRaster(input = filtered_data, base.raster = water.shape, coord.x = "Longitude", coord.y = "Latitude")

water.transition <- actel::transitionLayer(water.shape, directions = 8)

leaving just this code rsp.results <- runRSP(input = filtered_data, t.layer = water.transition, coord.x = "Longitude", coord.y = "Latitude")

From: YuriNiella notifications@github.com Reply to: YuriNiella/RSP reply@reply.github.com Date: Thursday, 29 October 2020 at 12:06 To: YuriNiella/RSP RSP@noreply.github.com Cc: "Jonathan Archer (PGR)" 2548871A@student.gla.ac.uk, Mention mention@noreply.github.com Subject: Re: [YuriNiella/RSP] runRSP:Error in if (is.numeric(v) && any(v < 0)) { : missing value where TRUE/FALSE needed (#17)

So your shapefile CRS is correct then (no need to include the CRS in the runRSP function). Because plotRaster is not working, it seems like your stations are not being given to RSP as a dataframe and that is what's crashing the code.

What happens if you run: class(filtered_data$spatial$stations) aux.station <- filtered_data$spatial$stations # Is this object returned as a dataframe of your acoustic stations?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/YuriNiella/RSP/issues/17#issuecomment-718709110, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ARRSXBQOQUCLSQP3MSKKJXLSNFK6ZANCNFSM4TCUT5CA.

YuriNiella commented 4 years ago

So, is runRSP now working or is it still crashing?

JonnyArcher commented 4 years ago

Sorry Yuri for not making this cleara

plotRaster is working now runRSP is not

Regards

Jonny

From: YuriNiella notifications@github.com Reply to: YuriNiella/RSP reply@reply.github.com Date: Thursday, 29 October 2020 at 18:05 To: YuriNiella/RSP RSP@noreply.github.com Cc: "Jonathan Archer (PGR)" 2548871A@student.gla.ac.uk, Mention mention@noreply.github.com Subject: Re: [YuriNiella/RSP] runRSP:Error in if (is.numeric(v) && any(v < 0)) { : missing value where TRUE/FALSE needed (#17)

So, is runRSP now working or is it still crashing?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/YuriNiella/RSP/issues/17#issuecomment-718927150, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ARRSXBU6WAQC2XXJQCIA3GDSNGVEVANCNFSM4TCUT5CA.

YuriNiella commented 4 years ago

In the plotRaster figure, are all stations being returned as in-water or are any stations being placed in land? If any stations are in land this will be an issue for runRSP() and potentially break the code like in your case. If all stations are correctly placed inside the water, it would help if you could provide an example workspace with the crashing data so I can reproduce the error and work out what's going on. Are you using the latest development version of RSP (1.0.0.9002)?

lbenit commented 4 years ago

Hi Yuri and Jonny,

This error has occurred for me too. I am using RSP with multiple datasets and this only has happened for two of my eight datasets. All of them use the same shapefile. I haven't figured out what the issue is yet, but it appears to be in filtered_data, rather than the shapefile. I added verbose=TRUE to runRSP and got this:

: Calculating RSP for the 'explore' data compiled on 2020-11-03 16:28:58 Warning: Could not find a 'Range' column in the spatial data; assuming a range of 500 metres for each receiver. Analysing: A69-1601-11026 Estimating A69-1601-11026 RSP: Track_1 |============================================================| 100% Estimating A69-1601-11026 RSP: Track_2 |============================================================| 100% Estimating A69-1601-11026 RSP: Track_3 |============================================================| 100% Estimating A69-1601-11026 RSP: Track_4 |============================================================| 100% Estimating A69-1601-11026 RSP: Track_5 |=================================== | 58%Error in if (is.numeric(v) && any(v < 0)) { : missing value where TRUE/FALSE needed

Let me know if you have ideas what might be causing this! So far, I haven't found anything obviously wrong with my dataset.

Thanks, Lorena

YuriNiella commented 4 years ago

Hi @lbenit ,

Thanks a lot for letting me know about that. That's really weird, are all your datasets from the same study area (so that you use the same shapefile or different ones for each of them)? I've been trying to reproduce this error but had no luck so far with any of my own datasets. I'd really appreciated it if you guys could share with me the data that's returning this error so that I can debug it. Maybe a subset of this problematic dataset that to only included the transmitter A69-1601-11026?

Cheers, Yuri

JonnyArcher commented 4 years ago

HI Yuri

We must be using different data but I shall run the verbose=TRUE and see which tag is the issue

And will try get my database to u by end of day

From: lbenit notifications@github.com Date: Tuesday, 3 November 2020 at 21:58 To: YuriNiella/RSP RSP@noreply.github.com Cc: Jonathan Archer (PGR) 2548871A@student.gla.ac.uk, Mention mention@noreply.github.com Subject: Re: [YuriNiella/RSP] runRSP:Error in if (is.numeric(v) && any(v < 0)) { : missing value where TRUE/FALSE needed (#17)

Hi Yuri and Jonny,

This error has occurred for me too. I am using RSP with multiple datasets and this only has happened for two of my eight datasets. All of them use the same shapefile. I haven't figured out what the issue is yet, but it appears to be in filtered_data, rather than the shapefile. I added verbose=TRUE to runRSP and got this:

: Calculating RSP for the 'explore' data compiled on 2020-11-03 16:28:58 Warning: Could not find a 'Range' column in the spatial data; assuming a range of 500 metres for each receiver. Analysing: A69-1601-11026 Estimating A69-1601-11026 RSP: Track_1 |============================================================| 100% Estimating A69-1601-11026 RSP: Track_2 |============================================================| 100% Estimating A69-1601-11026 RSP: Track_3 |============================================================| 100% Estimating A69-1601-11026 RSP: Track_4 |============================================================| 100% Estimating A69-1601-11026 RSP: Track_5 |=================================== | 58%Error in if (is.numeric(v) && any(v < 0)) { : missing value where TRUE/FALSE needed

Let me know if you have ideas what might be causing this! So far, I haven't found anything obviously wrong with my dataset.

Thanks, Lorena

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/YuriNiella/RSP/issues/17#issuecomment-721395423, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ARRSXBSPY2MCTQ66NJQEZRLSOB4FVANCNFSM4TCUT5CA.

YuriNiella commented 4 years ago

Hi @JonnyArcher

Yeah that's right, but as you guys are having exactly the same error, maybe after I solve the bug using one's data that should be fixed for the other as well. Sounds good, looking forward to it and debugging this!

Cheers

JonnyArcher commented 4 years ago

I Have attached the document that you requested

Also After running with verbrose=True I got this

################### rsp.results <- RSP::runRSP(input = filtered_data, t.layer = water.transition, coord.x = "Longitude", coord.y = "Latitude",verbose=TRUE) M: Calculating RSP for the 'explore' data compiled on 2020-11-04 10:13:11 Could not find a 'Range' column in the spatial data; assuming a range of 500 metres for each receiver.Analysing: A69-1105-129 Estimating A69-1105-129 RSP: Track_1 | | 0%If the coords argument is a SpatialPoints object, set its CRS first; the proj4string argument to this function is ignored.If the coords argument is a SpatialPoints object, set its CRS first; the proj4string argument to this function is ignored.If the coords argument is a SpatialPoints object, set its CRS first; the proj4string argument to this function is ignored.If the coords argument is a SpatialPoints object, set its CRS first; |============================================================| 100% Estimating A69-1105-129 RSP: Track_2 |======================================================= | 91%If the coords argument is a SpatialPoints object, set its CRS first; the proj4string argument to this function is ignored.If the coords argument is a SpatialPoints object, set its CRS first; |============================================================| 100% Estimating A69-1105-129 RSP: Track_3 |==== | 7%If the coords argument is a SpatialPoints object, set its CRS first; the proj4string argument to this function is ignored.If the coords argument is a SpatialPoints object, set its CRS first; |========= | 15%If the coords argument is a SpatialPoints object, set its CRS first; the proj4string argument to this function is ignored.If the coords argument is a SpatialPoints object, set its CRS first; |============ | 20%If the coords argument is a SpatialPoints object, set its CRS first; the proj4string argument to this function is ignored.If the coords argument is a SpatialPoints object, set its CRS first; |==================================================== | 87%If the coords argument is a SpatialPoints object, set its CRS first; the proj4string argument to this function is ignored.If the coords argument is a SpatialPoints object, set its CRS first; |============================================================| 100% Analysing: A69-1105-131 Estimating A69-1105-131 RSP: Track_1 |============================================================| 100% Analysing: A69-1105-133 Estimating A69-1105-133 RSP: Track_1 |============================================= | 75%If the coords argument is a SpatialPoints object, set its CRS first; the proj4string argument to this function is ignored.If the coords argument is a SpatialPoints object, set its CRS first; |============================================================| 100% Estimating A69-1105-133 RSP: Track_2 | | 0%If the coords argument is a SpatialPoints object, set its CRS first; the proj4string argument to this function is ignored.If the coords argument is a SpatialPoints object, set its CRS first; |============================================================| 100% Estimating A69-1105-133 RSP: Track_3 |==================================================== | 87%If the coords argument is a SpatialPoints object, set its CRS first; the proj4string argument to this function is ignored.If the coords argument is a SpatialPoints object, set its CRS first; |============================================================| 100% Estimating A69-1105-133 RSP: Track_4 |=== | 5%If the coords argument is a SpatialPoints object, set its CRS first; the proj4string argument to this function is ignored.If the coords argument is a SpatialPoints object, set its CRS first; the proj4string argument to this function is ignored. One of the inter-station RSP segments within Track_4 is too short to fit extra |============================================================| 100%detections. Estimating A69-1105-133 RSP: Track_5 |============================================================| 100% Analysing: A69-1105-135 Estimating A69-1105-135 RSP: Track_1 |============================================================| 100% Analysing: A69-1105-139 Estimating A69-1105-139 RSP: Track_1 |============================================================| 100% Estimating A69-1105-139 RSP: Track_2 |======= | 11%If the coords argument is a SpatialPoints object, set its CRS first; the proj4string argument to this function is ignored.If the coords argument is a SpatialPoints object, set its CRS first; |=========================================================== | 98%If the coords argument is a SpatialPoints object, set its CRS first; the proj4string argument to this function is ignored.If the coords argument is a SpatialPoints object, set its CRS first; the proj4string argument to this function is ignored.Error in if (is.numeric(v) && any(v < 0)) { : missing value where TRUE/FALSE needed Timing stopped at: 156.4 118.7 340.4

From: Jonathan Archer (PGR) 2548871A@student.gla.ac.uk Date: Wednesday, 4 November 2020 at 09:25 To: YuriNiella/RSP reply@reply.github.com, YuriNiella/RSP RSP@noreply.github.com Cc: Mention mention@noreply.github.com Subject: Re: [YuriNiella/RSP] runRSP:Error in if (is.numeric(v) && any(v < 0)) { : missing value where TRUE/FALSE needed (#17) HI Yuri

We must be using different data but I shall run the verbose=TRUE and see which tag is the issue

And will try get my database to u by end of day

From: lbenit notifications@github.com Date: Tuesday, 3 November 2020 at 21:58 To: YuriNiella/RSP RSP@noreply.github.com Cc: Jonathan Archer (PGR) 2548871A@student.gla.ac.uk, Mention mention@noreply.github.com Subject: Re: [YuriNiella/RSP] runRSP:Error in if (is.numeric(v) && any(v < 0)) { : missing value where TRUE/FALSE needed (#17)

Hi Yuri and Jonny,

This error has occurred for me too. I am using RSP with multiple datasets and this only has happened for two of my eight datasets. All of them use the same shapefile. I haven't figured out what the issue is yet, but it appears to be in filtered_data, rather than the shapefile. I added verbose=TRUE to runRSP and got this:

: Calculating RSP for the 'explore' data compiled on 2020-11-03 16:28:58 Warning: Could not find a 'Range' column in the spatial data; assuming a range of 500 metres for each receiver. Analysing: A69-1601-11026 Estimating A69-1601-11026 RSP: Track_1 |============================================================| 100% Estimating A69-1601-11026 RSP: Track_2 |============================================================| 100% Estimating A69-1601-11026 RSP: Track_3 |============================================================| 100% Estimating A69-1601-11026 RSP: Track_4 |============================================================| 100% Estimating A69-1601-11026 RSP: Track_5 |=================================== | 58%Error in if (is.numeric(v) && any(v < 0)) { : missing value where TRUE/FALSE needed

Let me know if you have ideas what might be causing this! So far, I haven't found anything obviously wrong with my dataset.

Thanks, Lorena

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/YuriNiella/RSP/issues/17#issuecomment-721395423, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ARRSXBSPY2MCTQ66NJQEZRLSOB4FVANCNFSM4TCUT5CA.

JonnyArcher commented 4 years ago

Sounds great canny wait to get some cool heat maps

I should note that the fish are sea trout so they don’t like swimming in a normal line like salmon hope that not an issue

Cheers for this

Look forward to this being debugged😊

From: YuriNiella notifications@github.com Date: Wednesday, 4 November 2020 at 11:33 To: YuriNiella/RSP RSP@noreply.github.com Cc: Jonathan Archer (PGR) 2548871A@student.gla.ac.uk, Mention mention@noreply.github.com Subject: Re: [YuriNiella/RSP] runRSP:Error in if (is.numeric(v) && any(v < 0)) { : missing value where TRUE/FALSE needed (#17)

Hi @JonnyArcherhttps://github.com/JonnyArcher

Yeah that's right, but as you guys are having exactly the same error, maybe after I solve the bug using one's data that should be fixed for the other as well. Sounds good, looking forward to it and debugging this!

Cheers

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/YuriNiella/RSP/issues/17#issuecomment-721679592, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ARRSXBS4S336PTSTCPPXQJTSOE3X7ANCNFSM4TCUT5CA.

YuriNiella commented 4 years ago

Hey @JonnyArcher Yeah there seems to be some issue with the CRS somewhere in your data. Sorry mate but the files didn't come through...are you sure you attached them all? Maybe the files are too big for sharing here?

lbenit commented 4 years ago

Hi again,

I have attached some data that is giving me this error. All of my data is from the same area, but the ones that are having issues have detection from more receivers than the others. I think it may be that my shapefile doesn't include a large enough area for the receivers that are on the margins. I am going to try and make a shapefile for a larger area and test it out.

Best, Lorena

input_files_error.zip

lbenit commented 4 years ago

It appears that changing the shapefile fixed the issue. The first image is of the shape I was using previously with the error and the second is the one I am using now. Hope this helps!

image

image

YuriNiella commented 4 years ago

Hi @lbenit ,

That's great news, thanks for letting us know. @JonnyArcher can you please maybe just check your shapefile does include all your receiver locations as well?

Also, you guys might find useful to check the buffer argument from ?actel::loadShape()...that might come in handy if your brownian bridge models crash because the receivers are too close to the shapefile borders, for example:

library(actel)
library(RSP)

water1 <- loadShape(path = system.file(package = "RSP"), 
                           shape = "River_latlon.shp", size = 0.0001, buffer = 0.01) 
water2 <- loadShape(path = system.file(package = "RSP"), 
                           shape = "River_latlon.shp", size = 0.0001, buffer = 0.03) 

par(mfrow = c(1,2))
raster::plot(water1, main = "buffer = 0.01", legend = FALSE)
raster::plot(water2, main = "buffer = 0.03", legend = FALSE)
Screen Shot 2020-11-04 at 1 05 58 pm