简体   繁体   English

如何在R中将数字打印为指数

[英]How to print a number as exponent in R

Figures can be displayed as exponent in unicode, like ¹. 可以将数字显示为Unicode指数,例如¹。 How can I use that to convert an arbitrary number to a string with exponent characters, and print that with R? 如何使用该函数将任意数字转换为带有指数字符的字符串,并使用R打印?

I can print figures 1 and 2 using http://en.wikipedia.org/wiki/Unicode_subscripts_and_superscripts but the other figures and minus doesn't work. 我可以使用http://en.wikipedia.org/wiki/Unicode_subscripts_and_superscripts打印数字1和2,但其他数字和减号无效。

FWIW, I use Rstudio on Windows. FWIW,我在Windows上使用Rstudio。

As you pointed out, unicode has support for all digits in a superscript form, so it should not be a problem if you can print/render UTF-8 characters. 如您所指出的,Unicode支持上标形式的所有数字,因此,如果您可以打印/呈现UTF-8字符,就不会有问题。 The problem is that the font you will use to display the string must support those characters and I guess most of them do not. 问题在于,用于显示字符串的字体必须支持这些字符,而我猜大多数字符都不支持。 If you are printing to a console, check out what font it uses and check if that font supports the characters you want to print. 如果要打印到控制台,请检查其使用的字体,并检查该字体是否支持要打印的字符。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM