我是 R 新手(我尝试过搜索;如果在其他地方重复,对不起!)我需要一些帮助!我正在尝试编辑 data.frame 中的行名:我从几个 vcf 文件开始并使用创建列表列表, lapply()
然后使用扁平列表 unlist()
并将提取的指标组合到数据框中,但最终得到以下结果:
> row.names(mydataframe)
[1] "1_S1_annotated_filtered.vcf.gz1" "1_S1_annotated_filtered.vcf.gz2" "1_S1_annotated_filtered.vcf.gz3" "1_S1_annotated_filtered.vcf.gz6"
[5] "1_S1_annotated_filtered.vcf.gz7" "1_S1_annotated_filtered.vcf.gz8"
...
[457] "6_S6_annotated_filtered.vcf.gz877" "6_S6_annotated_filtered.vcf.gz888" "6_S6_annotated_filtered.vcf.gz907" "7_S7_annotated_filtered.vcf.gz309"
[461] "7_S7_annotated_filtered.vcf.gz354" "7_S7_annotated_filtered.vcf.gz477" "7_S7_annotated_filtered.vcf.gz485" "7_S7_annotated_filtered.vcf.gz537"
[465] "7_S7_annotated_filtered.vcf.gz569" "7_S7_annotated_filtered.vcf.gz575" "7_S7_annotated_filtered.vcf.gz721" "7_S7_annotated_filtered.vcf.gz871"
[469] "7_S7_annotated_filtered.vcf.gz892" "8_S8_annotated_filtered.vcf.gz136" "8_S8_annotated_filtered.vcf.gz191" "8_S8_annotated_filtered.vcf.gz967"
而我需要的是
> row.names(mydataframe)
[1] "S1" "S1" "S1" "S1"
[5] "S1" "S1" "S1" "S1"
....
[469] "S7" "S8" "S8" "S8"
有什么建议吗?提前致谢!