docs: guard fetwfe()/betwfe() bacondecomp examples with requireNamespace (#260)#263
Merged
Merged
Conversation
…ace (#260) fetwfe() and betwfe()'s primary runnable @examples opened with a bare library(bacondecomp) + data(castle). bacondecomp is a Suggests-only dependency, so example(fetwfe) / example(betwfe) errored ("there is no package called 'bacondecomp'") for users without it installed. (R CMD check --as-cran installs Suggests, so the check was always clean -- this only bit interactive example() use.) Wrap each of the two affected example bodies in `if (requireNamespace("bacondecomp", quietly = TRUE)) { ... }`: with bacondecomp present (including under R CMD check) the example runs exactly as before; without it, it is silently skipped instead of erroring. Scope is deliberately just these two examples. etwfe()'s bacondecomp example is already inside \dontrun{} (never runs), and the three *WithSimulatedData examples use genCoefs()/simulateData() -- not bacondecomp -- so they are intentionally left untouched (gating them on bacondecomp would be wrong). Only man/fetwfe.Rd and man/betwfe.Rd regenerate. Version 1.26.0 -> 1.26.1; the NEWS 1.26.1 section also documents the #257 doc-clarity fix (twfeCovs estimand wording + genCoefs @param G "Optional") that merged via #259 without a NEWS entry. devtools::test(): FAIL 0 | WARN 0 | SKIP 0 | PASS 3351. R CMD check --as-cran: 0 errors | 0 warnings | 0 notes. Refs #260. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Refs #260.
fetwfe()andbetwfe()'s primary runnable@examplesopened with a barelibrary(bacondecomp)+data(castle).bacondecompis a Suggests-onlydependency, so
example(fetwfe)/example(betwfe)errored withthere is no package called 'bacondecomp'for any user without it installed.(
R CMD check --as-craninstallsSuggests, so the check itself was always clean —this only bit interactive
example()use.)Fix
Wrap each of the two affected example bodies in
if (requireNamespace("bacondecomp", quietly = TRUE)) { ... }. Withbacondecomppresent (including under
R CMD check) the example runs exactly as before; withoutit, the example is silently skipped instead of erroring.
Scope — deliberately just two examples
Only
fetwfe()andbetwfe()have un-guarded, runnable bacondecomp examples.The other estimator examples are intentionally left untouched:
etwfe()'s bacondecomp example is already inside\dontrun{}(never runs → noproblem).
fetwfeWithSimulatedData()/etwfeWithSimulatedData()/betwfeWithSimulatedData()usegenCoefs()/simulateData()and do not usebacondecompat all, so they must NOT be gated on it.(This is the narrowly-correct implementation of #260. The open drive-by PR #262
applied the
bacondecompguard to all six examples — including the threesimulateData-based ones that don't usebacondecomp— which is incorrect; thisPR supersedes it.)
Bookkeeping
NEWS.md1.26.1 section also documents the [docs] Clarify twfeCovs estimand wording (pooled, not separate) + genCoefs @param G "Optional" #257doc-clarity fix (twfeCovs estimand wording +
genCoefs()@param G"Optional"),which merged via docs: clarify twfeCovs estimand wording and add 'Optional' to genCoefs @param G #259 without a NEWS entry.
Gate results
air format .: clean.devtools::document(): regenerated onlyman/fetwfe.Rd+man/betwfe.Rd; no drift.devtools::test():[ FAIL 0 | WARN 0 | SKIP 0 | PASS 3351 ].R CMD check --as-cran: 0 errors | 0 warnings | 0 notes (Status OK), fetwfe 1.26.1.🤖 Generated with Claude Code