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

标签 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

我想要做的是将 的文本大写第四 柱子。
例如,现在我们有 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])

关于r - 将 R 数据框中特定列的文本大写,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18374986/

相关文章:

r - 在 `menu` 中指定等宽字体

r - RStudio 演示文稿/slidify/pandoc 中的两列布局

r - 从一个函数计算多列并将它们添加到 data.frame

python - pandas groupby 中增加日期

python - 添加一列,其中包含另一列中元组值的新值

r - R 中跨列的条件变异

R:ggplot::geom_path:每组仅包含一个观察值。需要调整群体审美吗?

dataframe - 将 QVD 文件导入 Jupyter notebook - python2

python - 如何拆分值并在 pandas 数据框中插入新行?

Python Pandas 堆积条形图 x 轴标签