Epiconcept-Paris / STRAP-epiuf

Utility function package for STRAP
0 stars 0 forks source link

Find and Replace error #109

Closed epi-clz closed 7 months ago

epi-clz commented 7 months ago

Hello @epi-gde

I found in line 237 in R/utilsFiles.R that there might be an error:

ReplaceWord <- ifelse((length(replacement<= i)),replacement[i],replacement[1])

The correct way would be

ReplaceWord <- ifelse(length(replacement)<= i,replacement[i],replacement[1])

Let me know

epi-gde commented 7 months ago

That's the incredible R language... this is not what I wanted but it runs ! Because (replacement <= i) return a vector filled with TRUE/FALSE on the same length than replacement !
It runs but it would give wrong result if we try to more than one replacement, because the first will always be used I add a test for that and I make the change ;)

epi-gde commented 7 months ago

Test added, vignette changed, check passed, changes pulled to main