title: How to write a space delimited txt file in R?
body: <p>I am very confused as I need to write a space delimited txt file, but columns have to be separated by space...</p>
  
  <p>for example, this is my script to generate the space delimited file</p>
  
  <pre><code>write.table(main_analysis_covariate,"main_analysis_covariate.txt",
              col.names=T, quote=F,sep=" ")
  
  head(main_analysis_covariate)
        FID     IID        V3      V4        V5         V6          V7        V8
  1 1004951 1004951 -13.53970 3.63737 -2.615650  3.4962900 -0.27603800 -0.709574
  2 1006785 1006785  -9.66567 2.49221 -0.391967 -0.0871995 -0.65907700 -0.181312
  3 1007378 1007378 -12.97970 3.78742  1.228940 -0.9096680  0.83237900  1.973190
  </code></pre>
  
  <p>but I want a file looks like this </p>
  
  <pre><code>FID IID phenotype1 covariate1 covariate2
  123456 123456 100 1 1
  234567 234567 20 2 1
  345678 345678 50 3 NA
  </code></pre>