fflr icon indicating copy to clipboard operation
fflr copied to clipboard

transaction_counter when leagueHistory = TRUE results in factor level [3] duplication error.

Open KevinLeone opened this issue 1 year ago • 1 comments

transaction_counter(leagueHistory=TRUE) results in following error: Error in `levels<-`(`*tmp*`, value = as.character(levels)) : factor level [3] is duplicated

traceback as follows:

  1. out_trans(teams = dat$teams[[i]], y = dat$seasonId[i], w = dat$scoringPeriodId[i])
  2. data.frame(seasonId = y, scoringPeriodId = w, teamId = teams$id,
  3. abbrev = factor(teams$abbrev, levels = teams$abbrev), waiverRank = teams$waiverRank, teams$transactionCounter)
  4. factor(teams$abbrev, levels = teams$abbrev)

Went to debug, but out_trans has no supported rdocumentation/cannot be loaded from installation. Would gladly take a bug fix to just pull each seasonId individually.

KevinLeone avatar Feb 25 '24 20:02 KevinLeone

I believe this is less a problem with transaction_counter() and more an issue with having duplicate team abbreviations. The error should come up with other functions that produce an abbrev factor column.

Abbreviations are factors in the order of teamId such that they always show up in the same order even if they change text.

The solution (without changing team abbreviations) is probably for the package to just not try to make these factors if they aren't unique.

k5cents avatar Sep 09 '24 16:09 k5cents