title: R text mining documents from CSV file
body: <p>First of all, my apology to repeat a question that was asked Aug 1 '13. But I cannot comment to the original question as I must have 50 reputation to be able to comment which I dont have. The original question can be retrieved from <a href="https://stackoverflow.com/questions/17997364/r-text-mining-documents-from-csv-file-one-row-per-doc">R text mining documents from CSV file (one row per doc)</a> . </p>
  
  <p>I am trying to work with the tm package in R, and have a CSV file of article abstracts with each line being a different abstract. I want each line to be a different document within the corpus. There are 2,000 rows in my data set.</p>
  
  <p>I run the following codes as previously suggested by Ben:</p>
  
  <pre><code># change this file location to suit your machine
  file_loc &lt;- "C:/Users/.../docs.csv"
  # change TRUE to FALSE if you have no column headings in the CSV
  x &lt;- read.csv(file_loc, header = TRUE)
  require(tm)
  corp &lt;- Corpus(DataframeSource(x))
  docs &lt;- DocumentTermMatrix(corp)
  </code></pre>
  
  <p>When I check class:</p>
  
  <pre><code># checking class
  class(docs)
  [1] "DocumentTermMatrix"    "simple_triplet_matrix" 
  </code></pre>
  
  <p>The problem is tm transformations do not work on this class:</p>
  
  <pre><code># Preparing the Corpus
  # Simple Transforms
  toSpace &lt;- content_transformer(function(x, pattern) gsub(pattern, " ", x))
  docs &lt;- tm_map(docs, toSpace, "/")
  </code></pre>
  
  <p>I get this error:</p>
  
  <pre><code>Error in UseMethod("tm_map", x) : 
  no applicable method for 'tm_map' applied to an object of class "c('DocumentTermMatrix', 'simple_triplet_matrix')"
  </code></pre>
  
  <p>or another code:</p>
  
  <pre><code>docs &lt;- tm_map(docs, toSpace, "/|@|nn|")
  </code></pre>
  
  <p>I get the same error:</p>
  
  <pre><code>Error in UseMethod("tm_map", x) : 
  no applicable method for 'tm_map' applied to an object of class "c('DocumentTermMatrix', 'simple_triplet_matrix')"
  </code></pre>
  
  <p>Your help would be greatly appreciated.</p>