mydata <- c(4.4, 8.5, 10.1, 14.0, 3.9)
mean.mydata <- mean(mydata)
sd.mydata <- sd(mydata)Rounding numbers
Brief intro to rounding
You can use the base R round() function to round numbers.
?round
For instance, it is a good rule of thumb to report the standard deviation to one more digit than the mean:
Now round the numbers:
round(mean.mydata, digits = 2)
#> [1] 8.18
round(sd.mydata, digits = 3)
#> [1] 4.191