PHEindicatormethods (version 1.1.5)

phe_mean: Calculate Means using phe_mean

Description

Calculates means with confidence limits using Student's t-distribution method.

Usage

phe_mean(data, x, type = "full", confidence = 0.95)

Arguments

data

a data.frame containing the data to calculate means for, pre-grouped if multiple means required; unquoted string; no default

x

field name from data containing the values to calculate the means for; unquoted string; no default

type

defines the data and metadata columns to be included in output; can be "value", "lower", "upper", "standard" (for all data) or "full" (for all data and metadata); quoted string; default = "full"

confidence

the required level of confidence expressed as a number between 0.9 and 1 or 90 and 100; numeric; default 0.95

Value

When type = "full", returns a data.frame of value_sum, value_count, stdev, value, lowercl, uppercl, confidence, statistic and method for each grouping set

See Also

Other PHEindicatormethods package functions: phe_dsr, phe_isr, phe_life_expectancy, phe_proportion, phe_quantile, phe_rate, phe_sii, phe_smr

Examples

Run this code
# NOT RUN {
library(dplyr)
df <- data.frame(values = c(30,40,50,60))
phe_mean(df, values)

## OR

df2 <- data.frame(area = rep(c("Area1", "Area2"),each=3),
                  values = c(20,30,40,200,300,400)) %>%
                  group_by(area)
phe_mean(df2,values)
phe_mean(df2,values,type="standard", confidence=0.998)


# }

Run the code above in your browser using DataLab