-2
all.ethnicity
이라는 벡터가 있습니다. 나는 grepl (또는 모든 기능) "아시아"를 원하고 첫 번째 요소에만 적용되고 두 번째 요소 "남아시아"에 대해서는 사실이 아닙니다. 참고 : ethnicity.type
개체를 사용해야합니다.grepl 전체 문자열 일치 개체를 사용하여
all.ethnicity <- c("Asian", "South Asian", "European")
ethnicity.type <- "Asian"
grepl(ethnicity.type,all.ethnicity)
결과
[1] TRUE FALSE FALSE
은 아마 단지 all.ethnicity == ethnicity.type''할 수있는 더 의미
^
붙여 넣기로 시도 할 수 있습니다 – thelatemail