Yue Pan
Yue Pan

Reputation: 11

Skimr error message when I try to do skim() with the data exported from REDCap

I would like to use the skimr package and skim() function to explore my data exported from REDCap, but it gives me this error message.

Error in `dplyr::summarize()`:
! Problem while computing `skimmed = purrr::map2(...)`.
ℹ The error occurred in group 4: skim_type = "numeric".
Caused by error:
! Can't combine `..1$numeric.p0` <labelled> and `..2$numeric.p0` <labelled>.
✖ Some attributes are incompatible.
ℹ The author of the class should implement vctrs methods.
ℹ See <https://vctrs.r-lib.org/reference/faq-error-incompatible-attributes.html>.
Backtrace:
  1. skimr::skim(e2)
 10. purrr::map2(...)
 12. skimr:::skim_by_type.data.frame(.x[[1L]], .y[[1L]], ...)
 13. skimr:::build_results(skimmed, variable_names, NULL)
 15. tidyr:::unnest.data.frame(out, .data$by_variable)
     ...
 19. vctrs (local) `<fn>`()
 20. vctrs::vec_default_ptype2(...)
 21. vctrs::stop_incompatible_type(...)
 22. vctrs:::stop_incompatible(...)
 23. vctrs:::stop_vctrs(...)
 Error in dplyr::summarize(grouped, skimmed = purrr::map2(.data$skimmers, : 

ℹ The error occurred in group 4: skim_type = "numeric".
Caused by error:
! Can't combine `..1$numeric.p0` <labelled> and `..2$numeric.p0` <labelled>.
✖ Some attributes are incompatible.
ℹ The author of the class should implement vctrs methods.
ℹ See <https://vctrs.r-lib.org/reference/faq-error-incompatible-attributes.html>.

Upvotes: 0

Views: 494

Answers (1)

Elin
Elin

Reputation: 6755

This is happening because the data are of class labelled. I'd have to understand more of the specifics of Redcap data formatted but I would suggest that for the purposes of skimming an easy solution is to convert to one of the standard data types.

Upvotes: 0

Related Questions