Skip to content

tibble_error_assign_incompatible_size when calling palms_build_trajectories() #13

Description

@JiueAnYang

(Running on R version 4.1.0)

Was following the steps in the A Complete Example using our own palm-processed cohort data.
No issues with reading data, creating field tables with , and was able to execute these two steps:

# Build palmsplus
palmsplus <- palms_build_palmsplus(palms)

# Build days
days <- palms_build_days(palmsplus)

However, encountered <error/tibble_error_assign_incompatible_size> after calling:

# Build trajectories
trajectories <- palms_build_trajectories(palmsplus)

Here is the output from rlang::last_error()

> rlang::last_error()
<error/tibble_error_assign_incompatible_size>
Assigned data `value` must be compatible with existing data.
x Existing data has 100 rows.
x Assigned data has 67 rows.
i Only vectors of size 1 are recycled.
Backtrace:
Run `rlang::last_trace()` to see the full context.

Following is the output from rlang::last_trace()

> rlang::last_trace()
<error/tibble_error_assign_incompatible_size>
Assigned data `value` must be compatible with existing data.
x Existing data has 100 rows.
x Assigned data has 67 rows.
i Only vectors of size 1 are recycled.
Backtrace:
     x
  1. +-palmsplusr::palms_build_trajectories(palmsplus)
  2. | \-`%>%`(...)
  3. +-dplyr::mutate_if(., is.logical, as.integer)
  4. | \-dplyr:::check_grouped(.tbl, "mutate", "if")
  5. |   \-dplyr::is_grouped_df(tbl)
  6. +-dplyr::mutate(., !!!args_after)
  7. +-sf::st_cast(., "LINESTRING")
  8. +-dplyr::summarise(., !!!args, do_union = FALSE)
  9. +-sf:::summarise.sf(., !!!args, do_union = FALSE)
 10. | +-base::`[[<-`(...)
 11. | +-dplyr:::`[[<-.grouped_df`(...)
 12. | +-base::NextMethod()
 13. | \-tibble:::`[[<-.tbl_df`(...)
 14. |   \-tibble:::tbl_subassign(...)
 15. |     \-tibble:::vectbl_recycle_rhs(...)
 16. |       +-base::withCallingHandlers(...)
 17. |       \-vctrs::vec_recycle(value[[j]], nrow)
 18. +-vctrs:::stop_recycle_incompatible_size(...)
 19. | \-vctrs:::stop_vctrs(...)
 20. |   \-rlang::abort(message, class = c(class, "vctrs_error"), ...)
 21. |     \-rlang:::signal_abort(cnd)
 22. |       \-base::signalCondition(cnd)
 23. \-(function (cnd) ...

I went on and test run the participant data one by one, and turned out this error happened only to some participants, at the same step when calling palms_build_trajectories(palmsplus).

Is this a known issue? Do you suggest any workaround? Thank you.

Activity

  1. TheTS commented on Nov 11, 2021

    @TheTS
    Owner

    Hi Jay

    Thanks for reporting this issue. It is quite hard to debug without seeing the data. As the issue is only present for some participants, and only during the build_trajectories step, I suspect there may be an issue with the PALMS data for these participants.

    About three years ago, I did see some PALMS data that had several ‘errors’ in the trips columns.

    The PALMS dataset has a column called tripType, which can be 1, 2, 3, or 4. The first point in the trip should always be 1 (startpoint), and the trip endpoint should always be coded as 4 (2 and 3 are midpoints and pausepoints, respectively). In the problematic dataset, I observed that some trips were missing an endpoint (so the trip ended with a midpoint or a pausepoint), and some trips started with a pausepoint. I’m not sure what caused this, but it was some sort of bug in PALMS, and I’ve only seen it once. PALMS was closed source at the time, so I didn’t bother looking into it. There might be a similar issue here.

    If you are able to share the data for a participant with an error (removing any long/lat information), I could confirm this.

    Cheers

    Tom

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions