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

nev*_*int 6 r dataframe

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

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
Run Code Online (Sandbox Code Playgroud)

我想要做的是将第四列的文本大写.所以现在我们有Notch1,它将被转换为NOTCH1.在R中做到这一点的方法是什么?我坚持这个:

dat<-read.table("http://dpaste.com/1353034/plain/")
Run Code Online (Sandbox Code Playgroud)

csg*_*pie 8

只需使用该toupper功能:

R> toupper(c("a", "ab"))
[1] "A"  "AB"
Run Code Online (Sandbox Code Playgroud)

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

dat[,4] = toupper(dat[,4])
Run Code Online (Sandbox Code Playgroud)