Kasper
Kasper

Reputation: 63

Superscripts in R

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

for example like:

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

but with the "TM" superscripted.

Anyone able to help?

Upvotes: 5

Views: 2021

Answers (1)

Amar
Amar

Reputation: 1373

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

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

Upvotes: 6

Related Questions