R中的上标 [英] Superscripts in R

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

问题描述

我正在尝试输出一个.xlsx文件,其列名带有上标文本。

I am trying to output a .xlsx file with a column name that has superscripted text.

例如:

holdings=data.frame("x"=rep(12,4), "y"=rep(14, 4))
colnames(holdings)=c("Name","RankTM")

,但标有 TM。

任何人都可以提供帮助吗?

Anyone able to help?

推荐答案

我建议这样做。列名应为纯文本,但是您可能有充分的理由这样做。

I suggest not doing that. Column names should be plain text but you may have a good reason for doing this.

找到 TM (2122)的unicode并像这样 \u那样对其进行转义\ + ### 。例如: colnames(holdings)= c( Name, Rank\u2122)

Find the unicode for TM (2122) and escape it like so \u\+###. eg: colnames(holdings) = c("Name","Rank\u2122")

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

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