将 R 数据框中特定列的文本大写

2023-11-21

我有一个数据,看起来像这样:

GO:2000974 7,8 negative_regulation_of_pro-B_cell_differentiation Notch1 ISS
GO:2000974 7,8 negative_regulation_of_pro-B_cell_differentiation Q9W737 IEA
GO:0001768 4 establishment_of_T_cell_polarity Ccl19 IEA 
GO:0001768 4 establishment_of_T_cell_polarity Ccl19 ISS 
GO:0001768 4 establishment_of_T_cell_polarity Ccl21 IEA

我想做的是将文本大写fourth柱子。 例如现在我们有Notch1,然后它会被转换为NOTCH1。 在R中该怎么做呢?我被这个问题困住了:

dat<-read.table("http://dpaste.com/1353034/plain/")

只需使用toupper功能:

R> toupper(c("a", "ab"))
[1] "A"  "AB"

对于您的数据框,您将拥有:

dat[,4] = toupper(dat[,4])
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

将 R 数据框中特定列的文本大写 的相关文章

随机推荐