fixed some pattern detection bugs

This commit is contained in:
2015-01-12 15:36:14 +01:00
parent fd4ea4a47e
commit efcdfae80e
4 changed files with 127 additions and 36 deletions
+4 -4
View File
@@ -28,13 +28,13 @@ convertLogical0 <- function(var) {
smartPatternMatch <- function(string, pattern, chars) {
if(chars < 5) {
found <- agrep(pattern, string, max.distance = list(all = 0), ignore.case = TRUE)
found <- agrep(pattern, string, max.distance = list(all = 0), ignore.case = TRUE, fixed = FALSE)
}
if(chars > 7) {
found <- agrep(pattern, string, max.distance = list(all = 2), ignore.case = TRUE)
else if(chars > 7) {
found <- agrep(pattern, string, max.distance = list(all = 2), ignore.case = TRUE, fixed = FALSE)
}
else {
found <- agrep(pattern, string, max.distance = list(all = 1), ignore.case = TRUE)
found <- agrep(pattern, string, max.distance = list(all = 1), ignore.case = TRUE, fixed = FALSE)
}
found <- convertLogical0(found)
return(found)