大写R中数据列中特定列的文本 [英] Capitalizing text of a specific column in R's data frame

查看:40
本文介绍了大写R中数据列中特定列的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have a data that looks like this:

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

我要做的是将第四列的文本大写。
例如,现在我们有 Notch1 ,然后将其转换为 NOTCH1
在R中是怎么做的?我对此感到困惑:

What I want to do is to capitalize the text of the fourth column. So for example now we have Notch1, it'll then be converted to NOTCH1. What's the way to do it in R? I'm stuck with this:

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


推荐答案

只需使用 toupper 函数:

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

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

For your data frame, you will have:

dat[,4] = toupper(dat[,4])

这篇关于大写R中数据列中特定列的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆