Q:

How to get fwrite() not to double quotes? 

I read a csv file containing html code in its fields using fread, do some maintenance on it and write the resulting datatable to a file using fwrite.  Problem is that now all the html is filled with quadruple quotes such as colspan="""""7"""".  There is the qmethod argument but I'm not sure how to use it as I'm not interested to escape quotes with backslash either.  
Is it possible to avoid that or do I have to use sed ? 
For instance I got the csv file :
htmlcode,id
<colspan="7">,1
<colspan="8">,2

I read that into a datatable with fread, I remove the id column and write the datatable back into a csv file with fwrite I get: 
htmlcode
<colspan=""""7"""">
<colspan=""""8"""">

A:

Two possible solutions (using v1.10.0 of data.table):
1: Use the quote = FALSE parameter:
fwrite(dt, 'fwrite.csv', quote = FALSE)

When opening the file in a text editor, you will see this:
htmlcode
<colspan="7">
<colspan="8">

2: Replace the double brackets with single one (as also suggeted by @joel.wilson in the comments):
dt[, htmlcode := gsub('\"', '\'', htmlcode)]
fwrite(dt, 'fwrite.csv')

When opening the file in a text editor, you will see this:
htmlcode
<colspan='7'>
<colspan='8'>

