Skip to content

Make param.list.flag() robust like its flag.* siblings - #46

Open
vertesy wants to merge 2 commits into
devfrom
refactor-param-list-flag-robustness
Open

Make param.list.flag() robust like its flag.* siblings#46
vertesy wants to merge 2 commits into
devfrom
refactor-param-list-flag-robustness

Conversation

@vertesy

@vertesy vertesy commented Aug 28, 2026

Copy link
Copy Markdown
Owner

Summary

param.list.flag() extracted its result with a hardcoded paste(...)[[3]], which only works when called as param.list.flag(par = p$name) (substitute(par) then deparses to a 3-element c("$", "p", "name") vector). Any other call shape — e.g. a plain variable — produces a length-1 vector and [[3]] throws "subscript out of bounds".

Its siblings flag.name_value() and flag.nameiftrue() solve the same problem more robustly: if (length(output) > 1) output <- output[length(output)]. Applied the same pattern here.

No behavior change for the existing p$name-shaped call sites; plain-variable calls that previously errored now work.

Version bumped 1.2.1 → 1.2.2 in Development/config.R and DESCRIPTION.

Validation

R CMD check and the existing testthat suite (7/7 passing) were run on this branch; manually verified both the p$name call shape and a plain-variable call now work correctly. Remaining R CMD check findings (parFlags example error, parsepvalue undocumented prefix, %!in% Rd-name warning, sandbox locale warning) are pre-existing and out of scope, addressed in other PRs in this batch or environment-inherent.


Generated by Claude Code

claude added 2 commits August 27, 2026 21:21
param.list.flag() extracted its result with a hardcoded
paste(...)[[3]], which only works when called as
param.list.flag(par = p$name) (substitute(par) then deparses to a
3-element c("$", "p", "name") vector). Any other call shape, e.g. a
plain variable, produces a length-1 vector and [[3]] throws "subscript
out of bounds".

Its siblings flag.name_value() and flag.nameiftrue() solve the same
problem more robustly: if (length(output) > 1) output <-
output[length(output)]. Applied the same pattern here. No behavior
change for the existing p$name-shaped call sites; plain-variable calls
that previously errored now work.

Version bumped 1.2.1 -> 1.2.2 in Development/config.R and DESCRIPTION.

Validation: R CMD check and the existing testthat suite (7/7 passing)
were run on this branch; manually verified both the p$name call shape
and a plain-variable call now work correctly. Remaining R CMD check
findings (parFlags example error, parsepvalue undocumented prefix,
%!in% Rd name warning, sandbox locale warning) are pre-existing and out
of scope, addressed in other PRs in this batch or environment-inherent.
…ag-robustness

# Conflicts:
#	DESCRIPTION
#	Development/config.R
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.

2 participants