This was spotted as I ran the test before sending Distance to CRAN, it did not exist a few weeks ago but is present in the versions of mrds and Distance currently on CRAN.
It is a recursive error and difficult to identify exactly where it is occuring.
Running the code line by line it appears to arise from dht2 and is replicated using
# import data
data(ClusterExercise)
ClusterExercise$Cluster.strat <- as.factor(ClusterExercise$Cluster.strat)
# setup data
# get rid of old region labels
ClusterExercise$Area <- sum(unique(ClusterExercise$Area))
ClusterExercise$Region.Label <- "Total"
# fit detection function
# df <- ds(ClusterExercise, truncation=1.5, key="hr",
# cutpoints=seq(0, 1.5, len=8), adjustment=NULL)
# exactly as in Distance for Windows
dat <- unflatten(ClusterExercise)
dat <- dat$data[!is.na(dat$data$distance), ]
dat <- dat[dat$distance<=1.5, ]
dat <- Distance::create_bins(dat, seq(0, 1.5, len=8))
# fit the exact function fitted by Distance
result <- ddf(dsmodel = ~mcds(key = "hr", formula = ~1),
data = dat, method = "ds",
meta.data = list(width = 1.5, binned=TRUE,
breaks=seq(0, 1.5, len=8)),
control=list(initial=list(scale=log(0.7067555),
shape=log(2.484188)),
nofit=TRUE))
df <- result
strat_N <- dht2(df, flatfile=ClusterExercise, strat_formula=~Cluster.strat,
stratification="object")
It was an issue with R studio that wasn;t fixed by simply opening a new session. All sessions had to be closed (I used task manager in the end) and start afresh.
This was spotted as I ran the test before sending Distance to CRAN, it did not exist a few weeks ago but is present in the versions of mrds and Distance currently on CRAN.
It is a recursive error and difficult to identify exactly where it is occuring.
Running the code line by line it appears to arise from dht2 and is replicated using