我想使用skimr包和skim()函数来探索从REDCap导出的数据,但是它给了我这个错误消息。
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>.发布于 2022-11-08 20:00:06
之所以会发生这种情况,是因为这些数据都是类标记的。我必须更多地了解Redcap格式化的细节,但我建议,为了方便浏览,一个简单的解决方案是将其转换为标准的数据类型之一。
https://stackoverflow.com/questions/73547866
复制相似问题