0
データフレーム内のすべての列を互いに移動させようとしています。これは、最初の列(下の名前付きの列)を列の数だけ繰り返すことを意味します。列を行に移動する
location 160095-T_S2_L001_R1_001.bam 160096-N_S4_L001_R1_001.bam 160094-T_S12_L001_R1_001.bam 160095-N_S1_L001_R1_001.bam
1:1-100000 NA NA NA NA
1:100001-200000 2 2 4 1
1:200001-300000 1 NA NA NA
1:300001-400000 3 3 3 3
2:1-100000 NA NA NA NA
2:100001-200000 1 1 NA NA
ので、それは次のようになります。
location sample_id number
1:1-100000 160095-T_S2_L001_R1_001.bam NA
1:100001-200000 160095-T_S2_L001_R1_001.bam 2
1:200001-300000 160095-T_S2_L001_R1_001.bam 1
1:300001-400000 160095-T_S2_L001_R1_001.bam 3
2:1-100000 160095-T_S2_L001_R1_001.bam NA
2:100001-200000 160095-T_S2_L001_R1_001.bam 1
1:1-100000 160096-N_S4_L001_R1_001.bam NA
1:100001-200000 160096-N_S4_L001_R1_001.bam 2
1:200001-300000 160096-N_S4_L001_R1_001.bam NA
1:300001-400000 160096-N_S4_L001_R1_001.bam 3
2:1-100000 160096-N_S4_L001_R1_001.bam NA
2:100001-200000 160096-N_S4_L001_R1_001.bam 1
1:1-100000 160094-T_S12_L001_R1_001.bam NA
1:100001-200000 160094-T_S12_L001_R1_001.bam 4
1:200001-300000 160094-T_S12_L001_R1_001.bam NA
1:300001-400000 160094-T_S12_L001_R1_001.bam 3
2:1-100000 160094-T_S12_L001_R1_001.bam NA
2:100001-200000 160094-T_S12_L001_R1_001.bam NA
1:1-100000 160095-N_S1_L001_R1_001.bam NA
1:100001-200000 160095-N_S1_L001_R1_001.bam 1
1:200001-300000 160095-N_S1_L001_R1_001.bam NA
1:300001-400000 160095-N_S1_L001_R1_001.bam 3
2:1-100000 160095-N_S1_L001_R1_001.bam NA
2:100001-200000 160095-N_S1_L001_R1_001.bam NA
私はトン(データフレーム)を転置試してみましたが、これは単に全体のデータフレームではなく、私が欲しいの列を転置します。
また、場所の列を分割して最初にコロンで区切り、次にダッシュで3つの別々の列に分割したいとします。これはあなたの例からdata.frame
を作成するために使用され、他の人が使用するため
:
chromosome start stop sample_id number
1 1 100000 160095-T_S2_L001_R1_001.bam NA
1 100001 200000 160095-T_S2_L001_R1_001.bam 2
1 200001 300000 160095-T_S2_L001_R1_001.bam 1
1 300001 400000 160095-T_S2_L001_R1_001.bam 3
2 1 100000 160095-T_S2_L001_R1_001.bam NA
2 100001 200000 160095-T_S2_L001_R1_001.bam 1
1 1 100000 160096-N_S4_L001_R1_001.bam NA
1 100001 200000 160096-N_S4_L001_R1_001.bam 2
1 200001 300000 160096-N_S4_L001_R1_001.bam NA
1 300001 400000 160096-N_S4_L001_R1_001.bam 3
2 1 100000 160096-N_S4_L001_R1_001.bam NA
2 100001 200000 160096-N_S4_L001_R1_001.bam 1
1 1 100000 160094-T_S12_L001_R1_001.bam NA
1 100001 200000 160094-T_S12_L001_R1_001.bam 4
1 200001 300000 160094-T_S12_L001_R1_001.bam NA
1 300001 400000 160094-T_S12_L001_R1_001.bam 3
2 1 100000 160094-T_S12_L001_R1_001.bam NA
2 100001 200000 160094-T_S12_L001_R1_001.bam NA
1 1 100000 160095-N_S1_L001_R1_001.bam NA
1 100001 200000 160095-N_S1_L001_R1_001.bam 1
1 200001 300000 160095-N_S1_L001_R1_001.bam NA
1 300001 400000 160095-N_S1_L001_R1_001.bam 3
2 1 100000 160095-N_S1_L001_R1_001.bam NA
2 100001 200000 160095-N_S1_L001_R1_001.bam NA
多分、これは長いかぎりの長形です。それを検索し、あなたの問題を解決するかどうかを確認してください。 – lmo