안녕하세요 트위터 검색을 통해 얻은 결과에서 단어를 제거하는 데 도움이 필요합니다. 여기에 제가 사용하는 코드가 있습니다.내 코퍼스 결과에서 스톱 워드를 제거 할 수 없습니다. R 프로그래밍
library("twitteR")
library("ROAuth")
cred$handshake()
save(cred, file="twitter.Rdata")
load("twitter.Rdata")
registerTwitterOAuth(cred)
tweets = searchTwitter('#apple', n = 100, lang = "en")
tweets.df = twListToDF(tweets)
names(tweets.df)
tweets.df$text
tweet.words = strsplit(tweets.df$text, "[^A-Za-z]+")
word.table = table(unlist(tweet.words))
library("tm")
myStopwords <- c(stopwords('english'), "#apple","http://")
tweet.corpus = Corpus(VectorSource(tweets.df$text))
tweet.corpus = tm_map(tweet.corpus,function(x) iconv(x, to='UTF8', sub='byte'))
tweet.corpus = tm_map(tweet.corpus, PlainTextDocument)
tweet.corpus = tm_map(tweet.corpus,removeWords, myStopwords)
tweet.dtm = DocumentTermMatrix(tweet.corpus)
tweet.matrix = inspect(tweet.dtm)
그러나 문제는 그것입니다 #apple를 포함하는 결과를 제거되지 않으며, 웹 사이트 주소는 http를을 포함 : // 코퍼스에서, 나는 이러한 결과를 제거하는 방법? 도와 줘서 고마워, 매트.
(HTTP : //stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). 문제는'tm' 명령에 실제로 있기 때문에 우리가 실행할 수없는 모든 twitterR 코드를 포함하여 적절한 자격 증명이 없기 때문에 실제로 도움이되지 않습니다. 문제를 재현하기 위해 다른 사람들이 복사/붙여 넣기 할 수있는 샘플 데이터를 포함해야합니다. – MrFlick