0

Me encuentro agrupando los datos de una base de datos, el código que uso es el siguiente:

Base_nueva<-base%>%group_by(aniomes, tipo, por_can, edad)%summarise(total)

pero me arroga el siguiente error:

Error in `summarise()`:
! Problem while computing `..1 =
  base_hist_can_202212$SUMASEG1`.
ℹ The error occurred in group 1026769: AnioMes = "NA-NA",
  TIPO = NA, Edad_Ase_v2 = "8", Por_Can_v2 = NA.
Caused by error in `vec_c()`:
! Negative `n` in `compact_rep()`.
ℹ In file utils.c at line 897.
ℹ Install the winch package to get additional debugging info the next time you get this error.
ℹ This is an internal error that was detected in the vctrs package.
  Please report it at <https://github.com/r-lib/vctrs/issues> with a reprex and the full backtrace.
Backtrace:
     ▆
  1. ├─... %>% summarise(base_hist_can_202212$SUMASEG1)
  2. ├─dplyr::summarise(., base_hist_can_202212$SUMASEG1)
  3. ├─dplyr:::summarise.grouped_df(., base_hist_can_202212$SUMASEG1)
  4. │ └─dplyr:::summarise_cols(.data, dplyr_quosures(...), caller_env = caller_env())
  5. │   ├─base::withCallingHandlers(...)
  6. │   └─dplyr:::map(quosures, summarise_eval_one, mask = mask)
  7. │     └─base::lapply(.x, .f, ...)
  8. │       └─dplyr (local) FUN(X[[i]], ...)
  9. │         └─vctrs::vec_c(!!!chunks_k, .ptype = types_k)
 10. └─rlang:::stop_internal_c_lib(...)
 11.   └─rlang::abort(message, call = call, .internal = TRUE, .frame = frame)

¿Alguien sabe como corregirlo?

Saludos

1
  • 1
    Difícil de saber sin poder auditar los datos, de todas formas te doy algunas sugerencias 1) modifica el summarise(total) por summarise(total=sum(total)) 2) Prueba si no es un tema de memoria con un set de datos mas pequeño. el 26 ene. a las 21:27

0

Tu Respuesta

Al pulsar en “Publica tu respuesta”, muestras tu consentimiento a nuestros términos de servicio, política de privacidad y política de cookies

Examina otras preguntas con la etiqueta o formula tu propia pregunta.