Fix namespace lookup failures in superbData without attaching package#10
Open
achetverikov wants to merge 2 commits into
Open
Fix namespace lookup failures in superbData without attaching package#10achetverikov wants to merge 2 commits into
achetverikov wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes a namespace lookup failure in
superbData()/superbPlot()when users pass namespaced strings likestatistic = "superb::mean"anderrorbar = "superb::CI"without attachingsuperbto the search path.It also removes global-environment side effects in
superbPlot()by eliminating dynamic wrapper creation (superbSTATISTIC/superbERRORBARin.GlobalEnv).Problem
1)
HyunhFeldtEpsilonlookup failure (within-subject CM/LM path)In
superbPlot(), diagnostics used:plyr::ddply(..., .fun = "HyunhFeldtEpsilon", ...)plyr::ddply(..., .fun = "WinerCompoundSymmetryTest", ...)plyr::ddply(..., .fun = "MauchlySphericityTest", ...)With string
.fun,plyrresolves viamatch.fun()and caller/search-path lookup.When
superbis not attached, this can fail with:object 'HyunhFeldtEpsilon' of mode 'function' was not found2) Global environment mutation
superbPlot()created temporary wrappers in.GlobalEnvviaeval(parse(...), envir = globalenv()):superbSTATISTICinit.superbSTATISTICsuperbERRORBARThis introduces side effects and can interfere with package usage patterns.
Changes
Commit 1:
Use function objects in ddply sphericity diagnosticsIn
R/superbPlot.R, replaced string.funwith function objects:"HyunhFeldtEpsilon"->HyunhFeldtEpsilon"WinerCompoundSymmetryTest"->WinerCompoundSymmetryTest"MauchlySphericityTest"->MauchlySphericityTestThis removes fragile search-path function lookup in the CM/LM diagnostics block.
Commit 2:
Remove globalenv wrappers for statistic and errorbarIn
R/superbPlot.R:eval(parse(...), envir = globalenv())wrapper generation.do.call("...")calls with direct function-object calls.statistic/errorbaras strings, including"namespace::name").Repro (before)
Could fail with:
object 'HyunhFeldtEpsilon' of mode 'function' was not foundValidation
PASS 291,FAIL 0,WARN 0,SKIP 0.superbvs patched) across between/within/mixed examples, with and withoutgamma:max_abs_diff = 0) for all previously working cases.exists("superbSTATISTIC", .GlobalEnv, inherits = FALSE)->FALSEexists("superbERRORBAR", .GlobalEnv, inherits = FALSE)->FALSE