[R] Formatting column displays

Ulrik Stervbo ulrik.stervbo at gmail.com
Fri May 5 14:56:35 CEST 2017


Hi Bruce,

display as in the console or as a table for presentation?

For the latter, look at sprintf:

sprintf("%,1f", 1)
sprintf("%.2f", 2.5678)
sprintf("$%.3f", 2.5678)

HTH
Ulrik

On Fri, 5 May 2017 at 14:08 Bruce Ratner PhD <br at dmstat1.com> wrote:

> R-helpers:
> I need some references for formatting the display of my data frame columns.
> Any guidance will be appreciated. Bruce
> ~~
> I have a date frame with one column as an integer for which I want a comma
> display,
> one column consisting of dollar amounts, one column for which I want a
> display to two digits after the decimal point, and one column as integers
> ranging between
> 100 - 999.
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list