title: How to keep only the highly significant variables in r and combine two entire corpus to make predictions?
body: <p>I'm using R and I have a file of blog posts with 3 variables: <strong>title</strong> (the title of the post), <strong>body</strong> (the text of the post) and <strong>great</strong> (1 if the post received five stars, 0 otherwise). I already created a corpus for the title, remove punctuation, converted it to lowercase, etc. as follows:</p>
  
  <pre><code>title = Corpus(VectorSource(posts$title))
  title = tm_map(title, tolower)
  title = tm_map(title, PlainTextDocument)
  title = tm_map(title, removePunctuation)
  title = tm_map(title, removeWords, stopwords("english"))
  title = tm_map(title, stemDocument)
  dtm = DocumentTermMatrix(title)
  sparseTerms = removeSparseTerms(dtm, 0.99)
  title = as.data.frame(as.matrix(sparseTerms))
  title$great = posts$great
  </code></pre>
  
  <p>I did the same process for the <strong>body</strong> variable. After that, I used <code>sample.split</code> to separate a training and a testing set (for the title) and used the <code>glm()</code> function to use a logistic regression:</p>
  
  <pre><code>library(caTools)
  spl = sample.split(title$great, 0.7)
  train = subset(title, spl = TRUE)
  test = subset(title, spl = FALSE) 
  Log = glm(great ~ ., data=train, family=binomial)
  summary(Log)
  </code></pre>
  
  <p>Now when I use <code>summary()</code> I can see which variables are significant (3 stars). And, as you can see, I only used the <strong>title</strong> variable at <code>glm()</code>. So I'd like to know:</p>
  
  <ol>
  <li>How to keep only the variables with 3 stars?</li>
  <li>How to combine the title and the body corpus so that I can use the glm() function with all the data?</li>
  </ol>
  
  <p>Thanks in advance.</p>