R - Removing the first and last character of a every factor in a data.table
<p>I'm new to R and I have the following quick question: 
What is the best way to delete the first and the last character of each "cell" in a data.table. I have imported the data from a .txt file in which the text has three-character separator - "^|^"?</p>

<p><code>DT &lt;- fread("file.txt", header = T, sep= "|")</code></p>

<pre><code>  Row     Conc   group
  ^1^     ^2.5^    ^A^
  ^2^     ^3.0^    ^A^
  ^3^     ^4.6^    ^B^
  ^4^     ^5.0^    ^B^
  ^5^     ^3.2^    ^C^
  ^6^     ^4.2^    ^C^
  ^7^     ^5.3^    ^D^
  ^8^     ^3.4^    ^D^ 
</code></pre>

<p>I am able to remove the "^"s column by column using the <code>stringi</code> package:</p>

<pre><code>DT[, Row := stri_sub(Row,2,-2)]    
</code></pre>

<p>It converts it to char, but that should be alright. 
However, as the data.table I am using has 46 columns, I am looking for more time-efficient way to do it. </p>