R/meansd.R

Defines functions meansd

Documented in meansd

###     -*- Coding: utf-8 -*-          ###
### Analyste Charles-Édouard Giguère   ###

### Creation of a function to display mean (sd)
meansd <- function(x, digits = c(1, 1)){
  if(length(digits) %in% 1)
    digits <- rep(digits, 1)
  format_str <- sprintf("%%.%df (%%.%df)", digits[1], digits[2])
  sprintf(format_str,
          mean(x, na.rm = TRUE),
          sd(x, na.rm = TRUE))
}

Try the CUFF package in your browser

Any scripts or data that you put into this service are public.

CUFF documentation built on March 31, 2023, 6:46 p.m.