Giter Site home page Giter Site logo

Comments (6)

zkamvar avatar zkamvar commented on June 15, 2024 1

think its simpler to leave within the function - people can then also use the funciton outside of an rmd if wanted.... just my reasoning but happy to be corrected!

I see these functions as helpers for calculating a certain value. These can be used for displaying tables, but can also be used for plotting and direct comparison. In the Rmarkdown document, we display the tables through kable(), which already has its own rounding facilities.

Besides, since the function returns a tibble, the rounding is not necessary even for those who don't use kable() since tibbles only print the significant digits by default.

Also more explaining to do if have to specify in options and in kable the num digits wanted...

I messed up the explanation here. The only thing that would be done is to move the digits argument to kable(), no messing around with options.

from sitrep.

zkamvar avatar zkamvar commented on June 15, 2024

I just found out that the digits option is different from the digits
specification in knitr kables

x <- tibble::enframe(runif(3) + 69)
knitr::kable(x, caption = "default: prints 7 digits")
default: prints 7 digits
name value
1 69.71135
2 69.97812
3 69.25433
options(digits = 2)
knitr::kable(x, caption = "options(digits = 2)")
options(digits = 2)
name value
1 70
2 70
3 69
options(digits = 7)
knitr::kable(x, digits = 2, caption = "options(digits = 7); kable(x, digits = 2)")
options(digits = 7); kable(x, digits = 2)
name value
1 69.71
2 69.98
3 69.25

Created on 2019-01-22 by the reprex package (v0.2.1)

from sitrep.

aspina7 avatar aspina7 commented on June 15, 2024

think its simpler to leave within the function - people can then also use the funciton outside of an rmd if wanted.... just my reasoning but happy to be corrected!
Also more explaining to do if have to specify in options and in kable the num digits wanted...

from sitrep.

dirkschumacher avatar dirkschumacher commented on June 15, 2024

I am a bit indifferent, not sure what is easier for folks.

from sitrep.

aspina7 avatar aspina7 commented on June 15, 2024

cool beans

from sitrep.

zkamvar avatar zkamvar commented on June 15, 2024

closed by #42

from sitrep.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.