The default var()
and sd()
R functions calculate the sample variance and standard deviation. But what if you want the population variance or standard deviation? Say hello to {popstats}
!
You can install the released version of popstats from GitHub with:
# install {remotes} package if not available
# install.packages("remotes")
remotes::install_github(repo = "hamedbh/popstats")
library(popstats)
pop_var(1:10)
#> 8.25
pop_var(c(1:10, NA))
#> NA
pop_var(c(1:10, NA), na.rm = TRUE)
#> 8.25
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.