title: removing decimals in R
body: <p>I have some column values as follows:</p>
  
  <pre><code>HG.1T.1
  HG.1T
  HG.1T.2
  HG.1T.3
  HG.1T.5
  HG.1T.11
  </code></pre>
  
  <p>I would like to remove everything after the second decimal and tried this</p>
  
  <pre><code> result&lt;-sapply(strsplit(rownames(trial),"\\."),function(x),paste0,head(x,-1),collapse="."))
  </code></pre>
  
  <p>and ended up with </p>
  
  <pre><code>HG.1T
  HG
  HG.1T
  HG.1T
  HG.1T
  HG.1T
  </code></pre>
  
  <p>It works fine except that for the second value since there is only one decimal value, it removes that. I want this to work only in instances of two decimals and let the one decimal values remain as such. How do I do that? It should be</p>
  
  <pre><code>HG.1T
  HG.1T
  HG.1T
  HG.1T
  HG.1T
  HG.1T
  </code></pre>