xx<-c("네이버","네이버에서","네이버를","inflearn","naver","naver에서","naver는","중앙일보","동아일보")
yy<-c("네이버","naver","저작권","뉴스","일보","에서")
###들어간 글자 찾기
xx[str_detect(xx,"네이버")]
xx[str_detect(xx,"naver")]
## 정확히 일치하는 것 찾기
xx[xx %in% "네이버"]
xx[xx %in% "naver"]
xx[xx %in% yy]
##네이버 또는 naver들어간 글자 찾기
xx[!(str_detect(xx,"네이버") | str_detect(xx,"naver"))]
xx[!(str_detect(xx,"네이버") | str_detect(xx,"naver"))]
##
xx[!(str_detect(xx,"네이버|naver|저작권|뉴스|일보"))]
##
zz<-apply(sapply(xx,str_detect,yy),2,sum)
xx[zz == 0]
반응형
'R중급' 카테고리의 다른 글
[Reduce함수/R] 여러 개 Matrix 한번에 sum/mean 시키기 (0) | 2020.06.19 |
---|---|
[R프로그래밍] R에서 함수내부 변수 외부에서 사용하는 방법 (0) | 2020.01.29 |
[ R프로그래밍] R에서 여러개의 변수 한번에 선언하는 방법 (0) | 2020.01.29 |
Keras R Accuracy History 보기 (0) | 2018.04.21 |
data.table 패키지 (0) | 2018.04.20 |
댓글