title: How to read a .csv file containing apostrophes into R?
body: <p>I am having difficulty getting R to read a .txt or .csv file that contains apostrophes.  </p>
  
  <p>Some of my columns contain descriptive text, such as "Attends to customers' needs" or "Sheriff's deputy". My file opens correctly in Excel (that is, all the data appear in the correct cells; there are 3 columns and about 8000 rows, and there is no missing data).  But when I ask R to read the file, this is what happens:</p>
  
  <pre><code>data &lt;-read.table("datafile.csv", sep=",", header=TRUE)
    Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,  : 
    line 520 did not have 3 elements
  </code></pre>
  
  <p>(Line 520 is the first line that contains an apostrophe.)</p>
  
  <p>If I go into the .txt or .csv file and manually remove all the apostrophes, then R reads the file correctly.  However, I'd rather keep the apostrophes if I can.</p>
  
  <p>I am new to R and would be grateful for any help.</p>