Hi folks
I'm trying to rerun some models through the package openCR. I know my code works just fine. At least it did last week, and I haven't changed it. But I'm suddenly getting this error with read.capthist
Error in [.default(DF,
chr) : invalid subscript type 'list'
Previously, making sure I have the latest versions of R and Rstudio have fixed these kinds of issues. I currently have R4.0.2 and RStudio 1.3.1073. And I'm still getting the error. All packages have been updated.
Can anyone help me please?
Thanks,
Cheryl
Cheryl Lohr
Research Scientist, Animal Science Program
DBCA Biodiversity and Conservation Science
Location: 37 Wildlife Pl, Woodvale, WA 6026
Mail: Woodvale Wildlife Research Centre
Locked Bag 104 Bentley Delivery Centre
WA 6983
Ph: 94055150 (internal ext 5750)
Mob: 0407335004

On 14 Aug 2020, at 11:37 am, Cheryl Lohr <chery...@dbca.wa.gov.au> wrote:
Hi folks
I'm trying to rerun some models through the package openCR. I know my code works just fine. At least it did last week, and I haven't changed it. But I'm suddenly getting this error with read.capthist
Error in[.default(DF, chr) : invalid subscript type 'list'Previously, making sure I have the latest versions of R and Rstudio have fixed these kinds of issues. I currently have R4.0.2 and RStudio 1.3.1073. And I'm still getting the error. All packages have been updated.
Can anyone help me please?
Thanks,
Cheryl
Cheryl LohrResearch Scientist, Animal Science ProgramDBCA Biodiversity and Conservation ScienceLocation: 37 Wildlife Pl, Woodvale, WA 6026Mail: Woodvale Wildlife Research CentreLocked Bag 104 Bentley Delivery CentreWA 6983Ph: 94055150 (internal ext 5750)Mob: 0407335004
<image001.png>
This message is confidential and is intended for the recipient named above. If you are not the intended recipient, you must not disclose, use or copy the message or any part of it. If you received this message in error, please notify the sender immediately by replying to this message, then delete it from your system.
--
You received this message because you are subscribed to the Google Groups "secr" group.
To unsubscribe from this group and stop receiving emails from it, send an email to secrgroup+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/secrgroup/MEAPR01MB4184C2ECFBEB393C4B578D5392400%40MEAPR01MB4184.ausprd01.prod.outlook.com.
Hi Jo,
Thanks for getting back to me. Unfortunately, that solution didn’t work. I presume I added in the verify=TRUE correctly (see below).
I don’t think my case supports the idea that the problem is with R4.0 as I didn’t download R4.0 until after this error appeared. I’ve also posted this problem to StackOverflow.
BL<-read.capthist(captfile="2010_2011_BL_SECR_capturedata.txt",
trapfile = list("2010MAR_BL_SECR_traplocs.txt",
"2010APR_BL_SECR_traplocs.txt",
"2010JUN_BL_SECR_traplocs.txt",
"2010JUL_BL_SECR_traplocs.txt",
"2010AUG_BL_SECR_traplocs.txt",
"2010OCT_BL_SECR_traplocs.txt",
"2010NOV_BL_SECR_traplocs.txt",
"2011MAR_BL_SECR_traplocs.txt",
"2011MAY_BL_SECR_traplocs.txt",
"2011JUN_BL_SECR_traplocs.txt",
"2011AUG_BL_SECR_traplocs.txt"),
detector = "multi",
fmt=c("trapID","XY"),
verify=TRUE)
Thanks,
Cheryl
Cheryl Lohr
Research Scientist, Animal Science Program
DBCA Biodiversity and Conservation Science
Location: 37 Wildlife Pl, Woodvale, WA 6026
Mail: Woodvale Wildlife Research Centre
Locked Bag 104 Bentley Delivery Centre
WA 6983
Ph: 94055150 (internal ext 5750)
Mob: 0407335004

From: Joanne Potts <joa...@theanalyticaledge.com>
Sent: Friday, 14 August 2020 9:41 AM
To: Cheryl Lohr <chery...@dbca.wa.gov.au>
Cc: secr <secr...@googlegroups.com>
Subject: Re: Error in [.default(DF, chr) : invalid subscript type 'list'
[External Email] This email was sent from outside the department – be cautious, particularly with links and attachments.
> library(secr)
This is secr 4.3.0. For overview type ?secr
Warning message:
package ‘secr’ was built under R version 4.0.2
>
> # generate some text files
> write.capthist(ovenCH)
>
> CH <- read.capthist(captfile = 'ovenCHcapt.txt', trapfile = 'ovenCHtrap.txt',
+ detector = 'multi')
No errors found :-)
>
> CHtrapsbysession <- read.capthist(captfile = 'ovenCHcapt.txt',
+ trapfile = list(
+ 'ovenCHtrap.txt',
+ 'ovenCHtrap.txt',
+ 'ovenCHtrap.txt',
+ 'ovenCHtrap.txt',
+ 'ovenCHtrap.txt'),
+ fmt = "trapID",
+ detector = 'multi')
No errors found :-)
>
> identical(summary(CH, terse = TRUE), summary(CHtrapsbysession, terse = TRUE))
[1] TRUE
>
> sessionInfo()
R version 4.0.0 (2020-04-24)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
Matrix products: default
Random number generation:
RNG: Mersenne-Twister
Normal: Inversion
Sample: Rounding
locale:
[1] LC_COLLATE=English_New Zealand.1252 LC_CTYPE=English_New Zealand.1252 LC_MONETARY=English_New Zealand.1252
[4] LC_NUMERIC=C LC_TIME=English_New Zealand.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] secr_4.3.0
loaded via a namespace (and not attached):
[1] Rcpp_1.0.4.6 codetools_0.2-16 lattice_0.20-41 digest_0.6.25 MASS_7.3-51.6
[6] grid_4.0.0 nlme_3.1-147 magrittr_1.5 evaluate_0.14 RcppParallel_5.0.1
[11] stringi_1.4.6 rlang_0.4.6 raster_3.1-5 sp_1.4-1 Matrix_1.2-18
[16] rmarkdown_2.1 splines_4.0.0 tools_4.0.0 stringr_1.4.0 RcppNumerical_0.4-0
[21] xfun_0.15 yaml_2.2.1 abind_1.4-5 parallel_4.0.0 compiler_4.0.0
[26] mgcv_1.8-31 htmltools_0.4.0 knitr_1.29 Hi Murray,
Thanks so much for your email. The verify=FALSE has worked.
Thanks,
Cheryl
Cheryl Lohr
Research Scientist, Animal Science Program
DBCA Biodiversity and Conservation Science
Location: 37 Wildlife Pl, Woodvale, WA 6026
Mail: Woodvale Wildlife Research Centre
Locked Bag 104 Bentley Delivery Centre
WA 6983
Ph: 94055150 (internal ext 5750)
Mob: 0407335004

From: secr...@googlegroups.com <secr...@googlegroups.com>
On Behalf Of Murray Efford
Sent: Friday, 14 August 2020 1:47 PM
To: secr <secr...@googlegroups.com>
Subject: Re: Error in [.default(DF, chr) : invalid subscript type 'list'
[External Email] This email was sent from outside the department – be cautious, particularly with links and attachments.
I've looked at Cheryl's data and it's fine. The problem is in verify(). I think Jo meant to suggest verify = FALSE, which dodges the issue.
--
You received this message because you are subscribed to the Google Groups "secr" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
secrgroup+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/secrgroup/631c8170-4a31-44b1-952d-c15d9debacfbo%40googlegroups.com.