2

我有一个如下所示的数据框,我想在序列前面添加 4 个字母(CATG)。那可能吗?谢谢你们!

   test<-as.data.frame("ACTCAATAAACATAGCT",
   "TTTGACAGTATTGTTTG", 
   "CTTTTCAAGAGTGATGG",
   "GCGACTCCCATCAGTGA", 
   "GCCAGCCACACATCAGG", 
   "TTTATTTAAGAGGAAGA", 
   "GTCTGAAGAATTGTTCA", 
   "ATTCTGATACTAATATA",
   "CTCCACGTCCACCCCAA", 
   "GGGAAGTCTGCCCTGCT")

应该是这样的结果!

   CATGACTCAATAAACATAGCT
   CATGTTTGACAGTATTGTTTG 
   CATGCTTTTCAAGAGTGATGG
   CATGGCGACTCCCATCAGTGA 
   CATGGCCAGCCACACATCAGG 
   CATGTTTATTTAAGAGGAAGA 
   CATGGTCTGAAGAATTGTTCA 
   CATGATTCTGATACTAATATA
   CATGCTCCACGTCCACCCCAA 
   CATGGGGAAGTCTGCCCTGCT
4

1 回答 1

5
test<-data.frame(V1=c("ACTCAATAAACATAGCT",
   "TTTGACAGTATTGTTTG", 
   "CTTTTCAAGAGTGATGG",
   "GCGACTCCCATCAGTGA", 
   "GCCAGCCACACATCAGG", 
   "TTTATTTAAGAGGAAGA", 
   "GTCTGAAGAATTGTTCA", 
   "ATTCTGATACTAATATA",
   "CTCCACGTCCACCCCAA", 
   "GGGAAGTCTGCCCTGCT"))
> test$V1<-paste0('CATG',test$V1)
> test
                      V1
1  CATGACTCAATAAACATAGCT
2  CATGTTTGACAGTATTGTTTG
3  CATGCTTTTCAAGAGTGATGG
4  CATGGCGACTCCCATCAGTGA
5  CATGGCCAGCCACACATCAGG
6  CATGTTTATTTAAGAGGAAGA
7  CATGGTCTGAAGAATTGTTCA
8  CATGATTCTGATACTAATATA
9  CATGCTCCACGTCCACCCCAA
10 CATGGGGAAGTCTGCCCTGCT
于 2012-08-21T09:57:28.180 回答