sdCalc: Shows the steps in the manual calculation of the standard...

Description Usage Arguments Value Note See Also Examples

View source: R/sims-teaching.R

Description

Shows the steps in the manual calculation of the standard deviation.

Usage

1
2
3
4
sdCalc(x, digits = getOption("digits"))

## S3 method for class 'sdCalc'
print(x, ...)

Arguments

x

A numeric vector

digits

A numeric indicating the number of decimals to round the numeric summaries to. If left at NULL (default) then the number of digits will be obtained from getOption('digits')

...

Other arguments to the generic print functions (not currently used)

Value

A list containing the sample size (n), sample mean (mean), data.frame of intermediate calculations (tbl), and number of digits to print (digits)).

Note

This function shows a table of intermediate output in the calculation of the standard deviation. Used purely to demonstrate the hand-calculation of the standard deviation. Use sd to actually compute the standard deviation.

See Also

sd

Examples

1
2
3
4
5
6
7
8
## Numeric vector
y <- runif(8)
# typical computation
sd(y)   
# this function           
sdCalc(y)            
# this function, controlling the number of digits
sdCalc(y,digits=4)

droglenc/NCStats documentation built on June 5, 2021, 2:06 p.m.