title: When using sapply,I get Error in str2lang(x) : <text>:1:31: unexpected symbol 1 ^
body: <p>When run this code,I will get an error:</p>
  <pre><code>genes&lt;-colnames(survdata)[-c(1:3)]
  univ_formulas&lt;-sapply(genes,function(x)as.formula(paste('Surv(OS,status)~',x)))
  Error in str2lang(x) : &lt;text&gt;:1:31: unexpected symbol
  1: Surv(OS,status)~ ABC7-42389800N19.1
                                    ^
  </code></pre>
  <p>If I remove the element and run the code again, a similar error appears again:</p>
  <pre><code>univ_formulas&lt;-sapply(genes,function(x)as.formula(paste('Surv(OS,status)~',x)))
  Error in str2lang(x) : &lt;text&gt;:1:26: unexpected symbol
  1: Surv(OS,status)~ CITF22-1A6.3
                               ^
  </code></pre>
  <p>I don't know where the wrong is.</p>
  <p>example of the data:</p>
  <pre><code>head(genes,n = 50)
   [1] &quot;A1BG&quot;               &quot;A1BG-AS1&quot;           &quot;A2M&quot;               
   [4] &quot;A2M-AS1&quot;            &quot;A2ML1&quot;              &quot;A2MP1&quot;             
   [7] &quot;A3GALT2&quot;            &quot;A4GALT&quot;             &quot;AAAS&quot;              
  [10] &quot;AACS&quot;               &quot;AACSP1&quot;             &quot;AADAT&quot;             
  [13] &quot;AAED1&quot;              &quot;AAGAB&quot;              &quot;AAK1&quot;              
  [16] &quot;AAMDC&quot;              &quot;AAMP&quot;               &quot;AANAT&quot;             
  [19] &quot;AAR2&quot;               &quot;AARD&quot;               &quot;AARS&quot;              
  [22] &quot;AARS2&quot;              &quot;AARSD1&quot;             &quot;AASDH&quot;             
  [25] &quot;AASDHPPT&quot;           &quot;AASS&quot;               &quot;AATF&quot;              
  [28] &quot;AATK&quot;               &quot;AATK-AS1&quot;           &quot;ABAT&quot;              
  [31] &quot;ABC7-42389800N19.1&quot; &quot;ABCA1&quot;              &quot;ABCA10&quot;            
  [34] &quot;ABCA11P&quot;            &quot;ABCA12&quot;             &quot;ABCA13&quot;            
  [37] &quot;ABCA17P&quot;            &quot;ABCA2&quot;              &quot;ABCA3&quot;             
  [40] &quot;ABCA4&quot;              &quot;ABCA5&quot;              &quot;ABCA6&quot;             
  [43] &quot;ABCA7&quot;              &quot;ABCA8&quot;              &quot;ABCA9&quot;             
  [46] &quot;ABCB1&quot;              &quot;ABCB10&quot;             &quot;ABCB4&quot;             
  [49] &quot;ABCB6&quot;              &quot;ABCB7&quot;   
  
        
  </code></pre>