BiologicalRecordsCentre / sparta

Species Presence/Absence R Trends Analyses
http://biologicalrecordscentre.github.io/sparta/index.html
MIT License
21 stars 24 forks source link

Error with sessionInfo version #258

Closed 03rcooke closed 3 months ago

03rcooke commented 3 months ago

This is relevant to code within occDetFunc().

I think they have changed the structure returned by sessionInfo() in more recent versions of R.

So the current code session.info <- sessionInfo() packages <- c(sapply(session.info[7][[1]], function(x) x$Version), sapply(session.info[8][[1]], function(x) x$Version)) returns the error Error in x$Version : $ operator is invalid for atomic vectors.

I think we need to be explicit with the objects within sessionInfo and that should help if they change the order. This code works and doesn't produce an error session.info <- sessionInfo() packages <- c(sapply(session.info$otherPkgs, function(x) x$Version), sapply(session.info$loadedOnly, function(x) x$Version))

Else we could use the base function, packageVersion("sparta")