jsocolar / flocker

flexible occupancy estimation in R
Other
26 stars 2 forks source link

get_Z currently fails when new_data contains fewer visits or fewer seasons than the original data #66

Closed jsocolar closed 9 months ago

jsocolar commented 1 year ago

We check that all of the important columns from the original data are present in the new data, but in doing so we incorrectly error when indexing columns are missing.

jsocolar commented 9 months ago

I think for a similar reason get_Z also fails in

fd1 <- simulate_flocker_data()
get_Z(example_flocker_model_single, new_data = fd1$unit_covs, history_condition = FALSE)
jsocolar commented 9 months ago

I think the problem is the assertion at line 154 of fitted_flocker.R

  assertthat::assert_that(
    all(names(flocker_fit$data) %in% names(new_data_fmtd)),
    msg = "new_data is missing columns required by flocker_fit (some covariates are missing or misnamed)"
  )

We need this not to apply to event covariates when only unit covariates are required, and we need this not to apply to unneeded indexing columns.

jsocolar commented 9 months ago

fixed via https://github.com/jsocolar/flocker/pull/94