Error in :: argument of length 0

what is wrong with this:

  if (sumGOOD != 0) {
    GOOD_share <- round(y$GOOD/sumGOOD, digits = 10)
  }
  else {
    GOOD_share <- 1:rowQty_y
    GOOD_share[1:rowQty_y] <- 0
  }
  if (sumBAD != 0) {
    BAD_share <- round(y$BAD/sumBAD, digits = 10)
  }
  else {
    BAD_share <- 1:rowQty_y
    BAD_share[1:rowQty_y] <- 0
  }

Where are sumGOOD and sumBAD defined? It would be helpful to have a reproducible example that allows us to see the definition of the objects and the output that is generated (i.e. where the error is thrown, etc.). The reprex package makes that particularly easy.

1 Like