0

When I do any data analysis through R, I'm getting the return of whole numbers only. Is there any way to receive a more exact estimation such as 2 decimal places.

For example:

survfit(Surv(data$TTE, data$event) ~ 1, data = data)

returns

Call: survfit(formula = Surv(data$TTE, data$event) ~ 1, data = data)

       n events median 0.95LCL 0.95UCL
[1,] 116     92      7       5       9

Whereas the median in other processing software is actually 7.1 months (95%CI 4.9 - 9.3). Is there a way to get this to return in a more exact way using my code?

neilfws
  • 32,751
  • 5
  • 50
  • 63
  • What you're seeing is just a printed summary. If you assign the output from `survfit` to a variable, then you can extract the values of all the different metrics including the median. See the linked answer for examples. – neilfws Aug 01 '23 at 04:19
  • Hi @neilfws when I do as is suggested in the example I get the increased number of decimals but still think R is rounding. As my next output is 7.0 months (95%CI 5.0 - 9.0) in what I know should be an output of 7.1 months (95%CI 4.9 - 9.3) – Lauren Julia Aug 01 '23 at 04:31
  • Perhaps your "other processing software" calculates things differently? It would help to [make the question reproducible](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) by including a small representative dataset in a plain text format - for example the output from `dput(data)`, if that is not too large, and to know what the other software was. – neilfws Aug 01 '23 at 04:34

0 Answers0