Learn R Programming

vannstats (version 1.5.4.07)

ci.calc: Simplified Confidence Interval Calculation

Description

This function calculates the confidence interval (for a given confidence level) for a variable in a given data frame.

Usage

ci.calc(df, var1, cl)

Value

This function returns the mean, lower bound, upper bound, and standard error.

Arguments

df

data frame to read in.

var1

the variable of interest for which the CI will be calculated.

cl

the desired confidence level (in percentages, ranging from \(1\) to \(100\)).

Examples

Run this code
data <- mtcars

ci.calc(data,mpg,95)

Run the code above in your browser using DataLab