Skip to content

Commit af48d46

Browse files
committed
Fix for multiple IMs
1 parent d7335d5 commit af48d46

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

R/im.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ member_regexp <- function(affiliations, im) {
2020
}, regex)
2121

2222
matches <- lapply(matches, function(x, im) {
23-
match <- im$canonical[as.vector(!is.na(stri_extract_all_regex(im$regexp, x, case_insensitive=TRUE)))]
23+
match <- im$canonical[as.vector(!is.na(stri_extract_first_regex(im$regexp, x, case_insensitive=TRUE)))]
2424
if (length(match)==0) return(NA)
25-
match
25+
match[1] # Only grabbing the first match to make sure the vector length stays the same
2626
}, im)
2727

2828
factor(unlist(matches), levels=im$canonical, labels=im$canonical)

0 commit comments

Comments
 (0)