means: =============================================================...

View source: R/mean.R

meansR Documentation

============================================================= TO BE REMOVED: this is here just for compatibility =============================================================

Description

Title means

Usage

means(
  df,
  ...,
  group_by_col = NULL,
  decimales = 2,
  show_warnings = TRUE,
  show_errors = FALSE,
  n = TRUE,
  missing = TRUE,
  min = TRUE,
  max = TRUE,
  mean = TRUE,
  sd = TRUE,
  median = TRUE,
  range = TRUE,
  norm.test = TRUE,
  col_names = c("var", "groups", "n.valid", "n.missing", "min", "max", "mean", "sd",
    "median", "range", "shapiro-wilk"),
  lang = "en",
  DEBUG = FALSE,
  show.help = FALSE
)

Arguments

df

data

...

any number of numerical variables

group_by_col

variable to group the others by

decimales

number of decimal to show

show_warnings

show warnings

show_errors

show errors

n

show n (without missing values)

missing

show number of missing values

min

show min value (or NA)

max

show max value (or NA)

mean

show mean value

sd

show standard deviation

median

show median

range

show range

norm.test

perform Shapiro-Wilks test and show p.value

col_names

column names for all columns (must set all or none)

Details

My own spin on the mean function, working as I like it

Value

data.frame with the corresponding stats

Examples


## Not run: 

data_ <- data.frame(AGE=sample(x = 65:100, size=30, replace = TRUE ),
                    HEIGHT=sample(x = 120:205, size=30, replace = TRUE ),
                    SEX=sample(x = c("Male", "Female"), prob = c(.5,.5), size = 30, replace = TRUE),
                    BLOND=sample(x = c("Yes", "No"), prob = c(.2,.8), size = 30, replace = TRUE)
)
data_ <- rbind(data_, list(NA,NA,NA,NA))
data_ <- rbind(data_, list(NA,NA,"Male",NA))
data_ <- rbind(data_, list(NA,NA,NA,"No"))

means(data_, AGE)

means(data_, AGE,HEIGHT)

mean(data_, AGE, group_by_col=SEX)


## End(Not run)


feranpre/udaicR documentation built on July 15, 2022, 12:54 p.m.