Skip to content

Commit

Permalink
Minor fix in 'vlookup' for case when variable 'ind' exists in the 'di…
Browse files Browse the repository at this point in the history
…ct' data.frame
  • Loading branch information
gdemin committed Jul 29, 2020
1 parent 87818b6 commit 91d6249
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion R/vlookup.R
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,10 @@ vlookup = function(lookup_value, dict, result_column = 2, lookup_column = 1, no_
} else {
res = dict[ind, result_column, drop = FALSE]
}
if(!identical(no_match, NA)) res[is.na(ind), ] = no_match
if(!identical(no_match, NA)) {
ind = is.na(ind)
res[ind, ] = no_match
}
res
}

Expand Down

0 comments on commit 91d6249

Please sign in to comment.