youngwoos / Doit_R

<Do it! 쉽게 배우는 R 데이터 분석> 저장소
213 stars 436 forks source link

교재 p.268 텍스트마이닝 특수문자 제거 #63

Closed shua0818 closed 2 years ago

shua0818 commented 2 years ago

안녕하세요, 텍스트마이닝 예제 연습하다가 문제가 있어서 질문 드립니다. p.268 에서 txt 파일 불러오기까지 실행하면 한글이 잘 나오는데

txt <- readLines("hiphop.txt") head(txt) image

아래 특수문자 제거 코드를 실행하면 한글이 다 깨져버립니다.

install.packages("stringr") library(stringr) txt <- str_replace_all(txt, "\\W", " ") image

R Studio 인코딩은 UTF-8로 설정해두었구요. txt 파일 문제인가 싶어 파일 인코딩 바꿔가면서 시도해봤는데 해결되지 않습니다. 무엇이 문제일까요..?ㅠㅠ

shua0818 commented 2 years ago

해결했습니다!

youngwoos commented 2 years ago

해결하셨다니 다행입니다. 어떤 방법으로 해결하셨는지 알려주시겠어요?