how to change the format of file in R

how to change the format of file in R

0

I want to change the format of file from input to output (this is just an example of my data)

input:

  > head(cpg_region2)
      cds       downstream     exon1       exons     intron1    introns      other    promoter            UTR3        UTR5
 1  1_47963035  1_68276036  1_47963035  1_47963035 1_33831751 1_33831751  1_32347715  1_48132522     11_18394188  1_68276036
 2  1_48088881  10_2648462 1_104414426  1_48088881 1_33831751 1_33831751  14_2527831  1_68276036     11_18394188  12_3142614
 3 1_168677980   12_396767 1_168677980  1_68276036 1_34481401 1_33831751  15_7112579  1_70154145      12_3134049 2_120841166
 4  10_2627156 14_12686663  12_3142614 1_104414426 1_48132522 1_33831751 17_10524429  1_70154145      13_9959153 20_13434035
 5  10_2627156 14_12686663  14_3960061 1_168677980 1_68276036 1_33831751  19_7740157 1_104414426      13_9959153   26_663159
 6  10_2627156  15_7007155 17_11003840  10_2627156 1_68276036 1_34188568   2_5702062 1_104414426      16_2178551   26_663159

output

                  cds       downstream     exon1       exons     intron1    introns      other    promoter      UTR3      UTR5
 1_47963035        1              0          1           1          0          0           0       0            0        0
 1_48088881        1              0          0           0          0          0           0       0            0        0
 1_68276036        0              1          0           0          0          0           0       0            0        0
 .
 .


R


table


column

• 30 views

Read more here: Source link