pathtrackR - S4 vector needs to be a double

Hi, I am using R for the first time as part of my dissertation and have been given code by my supervisor who got it from someone else (code attached below with comments from my supervisor). When I try to run it, I get this error and I am unsure how to resolve it.

Error at line 50:

My supervisor thinks that the issue is that when the pathtrackR package was created it relied on other packages which have subsequently been updated while it hasn't. These updated packages won't, in turn, function on an older version of R where pathtrackR will work, and so the two fall down.

We know that the error is because the S4 vector needs to be a double, but I don't have enough coding experience to examine the pathtrackR package myself to determine why this is the case.

I was wondering if there is a work-around without reworking the code, or if anyone has any other help or advice of what I could try.

Any help is much appreciated.

#########   REQUIRES AN OLDER VERSION OF R TO EFFECTIVELY RUN.   I AM USING 3.6 FOR THIS


install.packages("devtools")
library(devtools)
find_rtools()         #should return TRUE if an appropriate level of package is present (although F doesn't seem to affect functionality of package?)

if (!requireNamespace("BiocManager", quietly = TRUE))
  install.packages("BiocManager")
BiocManager::install("EBImage")
library(EBImage)
#ONLY NEED TO REVISIT GITHUB IF IT HASN'T BEEN UPDATED IN A WHILE
install_github("aharmer/pathtrackr", build_vignettes = TRUE)
install.packages("digest", dependencies=TRUE)  #seems to resolve issues about not instaling newest versions?
library(pathtrackr)


#####BIG ISSUE SEEMS TO BE ANY PROBLEM REQUIRES CLOSING R AND REOPENING......



#######################################################################
#######################################################################
#MANUAL TRACKING


#seems to be resolved on mac following additional install of XQuartz & Xcoe (had to find an old version from
#eg. https://stackoverflow.com/questions/7047735/where-can-i-download-old-versions-of-xcode  Need version 9.2 for 
#macOS Sierra 10.12.6)
#see also here https://www.r-bloggers.com/installing-r-on-os-x/

library(devtools)
find_rtools()         #should return TRUE if an appropriate level of package is present
library(pathtrackr)

###################   NB  OPENING MORE THAN 2 VIDEOS WITHOUT CLOSING & RESTARTING R LEADS TO 
###################   SIGNIFICANT SLOWING & EVENTUAL CRASHING OF R
###################   PROB A WORKING MEMORY ISSUE?
###################   EASIEST 'OPTION'FIX' IS TO CLOSE & REOPEN EACH TIME

rm(list=ls())
library(devtools)
#library(sp)
find_rtools()         #should return TRUE if an appropriate level of package is present (DOESN'T SEEM TO MATTER WHETHER TRUE OR FALSE???
library(pathtrackr)


####################################################################################################################################
#ww<-manualPath("/Volumes/LaCie/MarieCurieFellowship/2020Fieldwork/2020mp4vids/FirstTimes/710_C2_MAR6_1028",1000,1000,fps=4)
ww<-manualPath("~/Desktop/2020_Data/SLISCALED/806_C2_JAN09_1023",1000,1000,fps=4)
pdf(file='/Volumes/LaCie/MarieCurieFellowship/2020Fieldwork/2020_Data/SLI/pdf_images/806_Jan09.pdf')
plotPath(ww)      #saving image
dev.off()
plotSummary(ww)
pathSummary(ww) 
xx<-as.data.frame(ww$movement)
write.csv(xx, "/Volumes/LaCie/MarieCurieFellowship/2020Fieldwork/2020_Data/SLI/MovementData/sli806_Jan09.csv",row.names=F)
zz<-as.data.frame(ww$position)
write.csv(zz, "/Volumes/LaCie/MarieCurieFellowship/2020Fieldwork/2020_Data/SLI/PositionData/sli806_Jan09.csv",row.names=F)



####################################################################################################################################
#Second run of same commands. Allows you to realise you forgot to write the csv files without having lost all the work as all files are stored under new names
#pp<-manualPath("/Volumes/LaCie/MarieCurieFellowship/2020Fieldwork/2020mp4vids/FirstTimes/712_A4_MAR6_1045",1000,1000,fps=4)
pp<-manualPath("~/Desktop/2020_Data/SLISCALED/807_C7_JAN10_0910",1000,1000,fps=4)
pdf(file='/Volumes/LaCie/MarieCurieFellowship/2020Fieldwork/2020_Data/SLI/pdf_images/807_Jan10.pdf')
plotPath(pp)
dev.off()
plotSummary(pp)
pathSummary(pp) 
ll<-as.data.frame(pp$movement)
write.csv(ll, "/Volumes/LaCie/MarieCurieFellowship/2020Fieldwork/2020_Data/SLI/MovementData/sli807_Jan10.csv",row.names=F)
kk<-as.data.frame(pp$position)
write.csv(kk, "/Volumes/LaCie/MarieCurieFellowship/2020Fieldwork/2020_Data/SLI/PositionData/sli807_Jan10.csv",row.names=F)



####################################################################################################################################
#Third run of same commands. Ibid.
#yy<-manualPath("/Volumes/LaCie/MarieCurieFellowship/2020Fieldwork/2020mp4vids/FirstTimes/713_B4_MAR6_1052",1000,1000,fps=4)
yy<-manualPath("~/Desktop/2020_Data/SLISCALED/807_D5_JAN09_0846",1000,1000,fps=4) 
pdf(file='/Volumes/LaCie/MarieCurieFellowship/2020Fieldwork/2020_Data/SLI/pdf_images/807_Jan09.pdf')
plotPath(yy)
dev.off()
uu<-as.data.frame(yy$movement)
write.csv(uu, "/Volumes/LaCie/MarieCurieFellowship/2020Fieldwork/2020_Data/SLI/MovementData/sli807_Jan09.csv",row.names=F)
oo<-as.data.frame(yy$position)
write.csv(oo, "/Volumes/LaCie/MarieCurieFellowship/2020Fieldwork/2020_Data/SLI/PositionData/sli807_Jan09.csv",row.names=F)



####################################################################################################################################
#Fourth run of same commands. Ibid.

#ee<-manualPath("/Volumes/LaCie/MarieCurieFellowship/2020Fieldwork/2020mp4vids/FirstTimes/709_D2_MAR6_1020",1000,1000,fps=4)
ee<-manualPath("~/Desktop/2020_Data/SLISCALED/801_B8_JAN09_0947",1000,1000,fps=4)
pdf(file='/Volumes/LaCie/MarieCurieFellowship/2020Fieldwork/2020_Data/SLI/pdf_images/801_Jan09')
plotPath(ee)
dev.off()
rr<-as.data.frame(ee$movement)
write.csv(rr, "/Volumes/LaCie/MarieCurieFellowship/2020Fieldwork/2020_Data/SLI/MovementData/sli801_jan09.csv",row.names=F)
dd<-as.data.frame(ee$position)
write.csv(dd, "/Volumes/LaCie/MarieCurieFellowship/2020Fieldwork/2020_Data/SLI/PositionData/sli801_jan09.csv",row.names=F)



This topic was automatically closed 21 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.