Fix NA-in-coercion-to-boolean error in LinkNormalization() (cause of CRAN archival) - #85
Open
tamirlibel wants to merge 1 commit into
Open
Conversation
Two gsub() calls passed a stray fourth positional argument (".*")
that landed on gsub's ignore.case parameter instead of the intended
paste0() regex string, causing as.logical(".*") -> NA and a hard
error ("NA in coercion to boolean"). This broke LinkNormalization(),
and by extension LinkExtractor() and Rcrawler(), and is why the
package's CRAN examples failed and the package was archived from
CRAN on 2025-04-04.
Also drop the stray LazyData: TRUE (no data/ directory exists) and
add .Rbuildignore entries for .travis.yml and the unfilled LICENSE
template, clearing the remaining R CMD check NOTEs.
Verified with a clean R CMD check --as-cran: 0 errors, 0 warnings, 0 notes.
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
Error in gsub(...): NA in coercion to boolean, traced toLinkNormalization -> grepl -> paste0 -> gsub.gsub()calls inR/LinkNormalization.Rhad a stray 4th positional argument (".*") that was landing ongsub'signore.caseparameter instead of being part of the surroundingpaste0()regex string.as.logical(".*")isNA, which R's internalgsubrejects with a hard error. This brokeLinkNormalization(), and by extensionLinkExtractor()andRcrawler(), on every call.".*"out of thegsub()calls and into the enclosingpaste0()where it was clearly intended, restoring the original regex-building logic.LazyData: TRUEinDESCRIPTION(nodata/directory exists) and added.Rbuildignoreentries for.travis.ymland the unfilledLICENSEtemplate, clearing the remainingR CMD checkNOTEs.Test plan
LinkNormalization()@examplesblock directly — previously crashed withNA in coercion to boolean, now returns correctly normalized URLs.devtools::check(cran = TRUE)(R CMD check --as-cran) on R 4.6.0 — before: 1 error (examples), 2 notes; after: 0 errors, 0 warnings, 0 notes.Fixing this should let a resubmission to CRAN pass the automated checks that led to archival.