RossDwyer / VTrack

V-Track: software for analysing and visualising animal movement from acoustic telemetry detections
https://cran.r-project.org/web/packages/VTrack/index.html
13 stars 5 forks source link

Problem with estimating COA #14

Closed Ryantheshark84 closed 4 years ago

Ryantheshark84 commented 5 years ago

Hey Ross, Have been using VTrack for some time but my most recent visit has highlighted an error when i try to run the HR Summary. The COA() produces a list with 17 dataframes but when i try to run the COAdata in the HR Summary i get this error.

===================| 100% Error in UseMethod("tbl_vars") : no applicable method for 'tbl_vars' applied to an object of class "c('matrix', 'logical')"

Any information would be most helpful.

joleehaz commented 4 years ago

I also have this issue. Did you manage to resolve it? @Ryantheshark84

vinayudyawer commented 4 years ago

Hi @joleehaz , Would you be able to provide a reproducible example?

joleehaz commented 4 years ago

Hi @vinayudyawer

Thank you for your quick response.

The error I am getting is the same as above when I run

> VEMCOdata<- read.csv("VEMCOdata.csv")
> taginfo<- read.csv("taginfo.csv")
> statinfo<- read.csv("statinfo.csv") 
> ATTdata <- setupData(Tag.Detections = VEMCOdata, 
+                      Tag.Metadata = taginfo, 
+                      Station.Information = statinfo, 
+                      source="VEMCO",
+                      tzone= "UTC")
Geographic projection for detection positions not recognised, reverting to WGS84 global coordinate reference system
> COAdata<-COA(ATTdata, 
+              timestep = 60, ## timestep bin used to estimate centers of activity (in minutes)
+              split = TRUE)
> COA(COAdata)
Error in UseMethod("left_join") : #this error message also occurs with sample data 
  no applicable method for 'left_join' applied to an object of class "NULL" 
> library(raster)
> proj<-CRS("+init=epsg:32743")
> ## HRSummary() requires calculation of COAs first
> ## Estimate 100% Maximum Convex Polygon (MCP) areas
> 
> mcp_est <- HRSummary(COAdata, 
+                      projCRS=proj, 
+                      type="MCP", 
+                      cont=100,
+                      sub = "%Y-%W")
  |=============================================================================================================| 100%
Error in UseMethod("tbl_vars") : 
  no applicable method for 'tbl_vars' applied to an object of class "c('matrix', 'logical')"
In addition: There were 34 warnings (use warnings() to see them)
> warnings()
Warning messages:
1: Factor `Tag.ID` contains implicit NA, consider using `forcats::fct_explicit_na`
2: Factor `Tag.ID` contains implicit NA, consider using `forcats::fct_explicit_na`

This error does not occur when I use the VTrack sample data so I should think it is something to do with the format of my .csv files although I have been very careful to ensure they are in the same format as the sample files. I am unable to share my data here as it is licenced. Would you mind communicating via email? We can then post the resolution here if we find one!

Thank you!

vinayudyawer commented 4 years ago

Hey @joleehaz,

Sounds like the function is having a hard time finding data from the input data frame. In most cases, it might be a date time field. Happy to help via email if you can't share the data here. If you can send through your working code and an example dataset, I can see where the error might be coming from. My email is vinay.udyawer@gmail.com

joleehaz commented 4 years ago

@vinayudyawer kindly reviewed my data, and it seems that there are not enough detections to estimate activity spaces. Incorporating more data is likely to fix the issue.

Ryantheshark84 commented 4 years ago

@joleehaz @vinayudyawer , hi guys. I never got this working but when i reverted back to previous VTrack release it worked fine and i could estimate activity space. I uninstalled VTrack and then installed the version that wasnt the latest. On a side note, a colleague of mine has since got the HR_Summary working with the original dataset which would assume that there sufficient detections all along. Again, i tried to find the source of my issue with a big focus on date format but still no joy.