I am sinking output from a linear model, and trying to tidy it up as it is sinked by rounding the parameters I am interested in to 2 decimal places. This is fine for most parameters like beta or Z-score, but I am having difficulty with P-value. As although I do want to round to 2 decimal places, I mean 2 decimal places whilst retaining scientific notation.
For example:
P = 2.60699382414341e-56
round(P,2)
#[1] 0
When really what I want to print is :
#2.61e-56
Is there a means of doing this?
Try
signif(2.60699382414341e-56, digits=3)
# 2.61e-56
Use format
:
> P = 2.60699382414341e-56
> format(P, digits=3)
[1] "2.61e-56"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With