Skip to content

Fix as.named.vector.table() undefined-variable crash - #72

Merged
vertesy merged 2 commits into
devfrom
fix/as-named-vector-table-undefined-v
Aug 31, 2026
Merged

Fix as.named.vector.table() undefined-variable crash#72
vertesy merged 2 commits into
devfrom
fix/as-named-vector-table-undefined-v

Conversation

@vertesy

@vertesy vertesy commented Aug 31, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes the 1 bug flagged during the earlier code-annotation pass (#62), in R/CodeAndRoll2.R. Re-opening against dev — the previous attempt (#67) was closed without merging, targeted at main.

Why

as.named.vector.table() (deprecated in favor of c()) never actually built its return value v — the lines that construct it were commented out, so every call errored with "object 'v' not found". Restored the commented-out build logic.

Verified interactively via devtools::load_all().

The lines that build the return value `v` were commented out, so every
call errored with "object 'v' not found".

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0b360c679d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread R/CodeAndRoll2.R Outdated
Comment thread R/CodeAndRoll2.R Outdated
# names(v) <- dimnames(table)[[1]]
# Even after unclass(), the dim attribute remains, and is.vector() only returns TRUE if
# an object has no attributes other than names.
v <- as.vector(unclass(table))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Forward ... to as.vector()

  • Problem: as.named.vector.table() documents ... as arguments for as.vector(), but this call ignores them.
  • Trigger: A call such as as.named.vector.table(x, mode = "character") silently returns integer counts instead of character values.
  • Fix: Pass ... to as.vector(unclass(table), ...).

AGENTS.md reference: AGENTS.md:L10-L10

Useful? React with 👍 / 👎.

@vertesy

vertesy commented Aug 31, 2026

Copy link
Copy Markdown
Owner Author

@claude

could you please adress:

" Forward ... to as.vector()

Problem: as.named.vector.table() documents ... as arguments for as.vector(), but this call ignores them.
Trigger: A call such as as.named.vector.table(x, mode = "character") silently returns integer counts instead of character values.
Fix: Pass ... to as.vector(unclass(table), ...)."

@claude

claude Bot commented Aug 31, 2026

Copy link
Copy Markdown

Claude finished @vertesy's task in 46s —— View job


Done

  • Gather context (read R/CodeAndRoll2.R, PR diff, Codex review comments)
  • Forward ... to as.vector() in as.named.vector.table()
  • Commit and push fix
  • Final summary

Addressed the Codex P2 finding: as.named.vector.table() documents ... as extra args for as.vector(), but the call ignored them. Changed R/CodeAndRoll2.R:968:

v <- as.vector(unclass(table), ...)

Now calls like as.named.vector.table(x, mode = "character") correctly forward mode (and any other as.vector() arg) instead of silently returning integer counts.

Pushed as commit 0ed1332 to fix/as-named-vector-table-undefined-v.

Not addressed (out of scope for this request): the P1 suggestion to bump Development/config.R version — let me know if you'd like that done too.
·

The function documents ... as arguments for as.vector() but previously
ignored them, so calls like as.named.vector.table(x, mode = "character")
silently returned integer counts instead of character values.

Co-authored-by: Abel Vertesy <5101911+vertesy@users.noreply.github.com>
@vertesy
vertesy merged commit 13242dc into dev Aug 31, 2026
@vertesy
vertesy deleted the fix/as-named-vector-table-undefined-v branch August 31, 2026 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant