Formatting Decimal places in R

前端 未结 12 2079
忘了有多久
忘了有多久 2020-11-22 01:42

I have a number, for example 1.128347132904321674821 that I would like to show as only two decimal places when output to screen (or written to a file). How does one do that?

12条回答
  •  梦毁少年i
    2020-11-22 02:10

    Looks to me like to would be something like

    library(tutoR)
    format(1.128347132904321674821, 2)
    

    Per a little online help.

提交回复
热议问题