Why do R outputs numbers always come out with dot (.)?

Asked

Viewed 37 times

-1

When obtaining percentages and respective 95%CI the output I get as below:

> observed<-c(95,1202,26,921)
> require(DescTools)
Carregando pacotes exigidos: DescTools
> MultinomCI(observed,conf.level=0.95,method="sisonglaz")
            est     lwr.ci     upr.ci
[1,] 0.04233512 0.02094474 0.06449834
[2,] 0.53565062 0.51426025 0.55781385
[3,] 0.01158645 0.00000000 0.03374968
[4,] 0.41042781 0.38903743 0.43259103

Those est(estimated) and respective 95%CI are actually 4.233512%, 53.565062%, etc., written in this way (0.04233512, 0.53565062). I had to multiply these output values by 100 or simply move the colon 2 places to the right.

How do I return the output values without having to multiply them by 100 or move the comma?

I get lost with these numbers because sometimes Gero OR(odds ratio) and other estimates and I don’t know when I need to multiply (or shift the comma) and when I don’t need to.

  • 3

    These values "are actually 4.2%, 53.6% etc": no, they’re not. That’s how you don’t get lost, knowing what you’re doing. No one multiplies "for 100%", just listen to the sound of it: one hundred percent. This gives 100 por 100, that is 1. At best it is multiplied by 100, for the purpose of presenting the results, but to do the accounts we use real numbers.

  • 2

    I vote to close this question because it makes no sense, there is nothing useful for the PA let alone for others in the future.

  • Thank you! I note that the language R generates the results in this way (0.xx) on the scale from 0 to 1. And for better intelligibility, it has to consider two decimal places, i.e, multiply by 100, independent of the unit.

2 answers

0

Figures formatted as percentages are used for presentation or publication purposes, they are not numbers that can be counted, that is, they are not numbers. It’s not just a matter of scale.

With the question data,

library(DescTools)

observed <- c(95, 1202, 26, 921)
ci95 <- MultinomCI(observed, conf.level= 0.95, method = "sisonglaz")

you can use the formatting functions of the CRAN package scales to present strings as percentages.

perc95 <- scales::percent(ci95, trim = FALSE)
matrix(perc95, nrow = nrow(ci95))
#     [,1]     [,2]     [,3]    
#[1,] " 4.23%" " 2.09%" " 6.45%"
#[2,] "53.57%" "51.43%" "55.78%"
#[3,] " 1.16%" " 0.00%" " 3.37%"
#[4,] "41.04%" "38.90%" "43.26%"

-1

I note that the language R generates the results in this way (0.xx) on the scale from 0 to 1. And for better intelligibility, that is, to take the scale from 0 to 100, you have to consider two decimal places, i.e, multiply by 100.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.