如何在整列中获取名称的一部分?

时间:2014-05-05 09:37:31

标签: r

我有一个这样的专栏:

X.at1g01050.1.symbols.atppa1.ppa1.pyrophosphorylase1.chr1.31382.32670reverselength.212
X.at1g01080.1.symbols..rna.binding.rrm.rbd.rnpmotifs.familyprotein.chr1.45503.46789reverselength.293
X.at1g01090.1.symbols.pdh.e1alpha.pyruvatedehydrogenasee1alpha.chr1.47705.49166reverselength.428
X.at1g01220.1.symbols.fkgp.atfkgp.l.fucokinase.gdp.l.fucosepyrophosphorylase.chr1.91750.95552forwardlength.1055
X.at1g01320.2.symbols..tetratricopeptiderepeat.tpr..likesuperfamilyprotein.chr1.121582.130099reverselength.1787
X.at1g01420.1.symbols.ugt72b3.udp.glucosyltransferase72b3.chr1.154566.156011reverselength.481
X.at1g01470.1.symbols.lea14.lsr3.lateembryogenesisabundantprotein.chr1.172295.172826reverselength.151
X.at1g01800.1.symbols..nad.p..bindingrossmann.foldsuperfamilyprotein.chr1.293396.294888forwardlength.295
X.at1g01910.5.symbols..p.loopcontainingnucleosidetriphosphatehydrolasessuperfamilyprotein.chr1.313595.315644reverselength.249
X.at1g01920.2.symbols..setdomain.containingprotein.chr1.316204.319507forwardlength.547
X.at1g01960.1.symbols.eda10.sec7.likeguaninenucleotideexchangefamilyprotein.chr1.330830.337582reverselength.1750

这些数据的有趣部分如下所示:

X.**at1g01050.1**.symbols.atppa1.ppa1.pyrophosphorylase1.chr1.31382.32670reverselength.212

我可以通过在Excel中应用函数=MID(B1;3;11)来轻松获得它。我想在R中做同样的事情。

名称为

的列
tbl_end[,1]

1 个答案:

答案 0 :(得分:1)

使用substr

substr(tbl_end[,1],3,11)