Skip to content

Instantly share code, notes, and snippets.

@lundquist-ecology-lab
Last active December 27, 2022 01:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lundquist-ecology-lab/8ab1ec50853a37afb09805c9f321f7ec to your computer and use it in GitHub Desktop.
Save lundquist-ecology-lab/8ab1ec50853a37afb09805c9f321f7ec to your computer and use it in GitHub Desktop.
Summary statistics in R with examples
# Calculating mean, and other summary statistics in R with examples
# Set up
library(palmerpenguins)
data(penguins)
penguins <- na.omit(penguins)
# Mean
mean(penguins$bill_length_mm)
# Meadian
median(penguins$bill_length_mm)
# Mean, median and quartiles
summary(penguins$bill_length_mm)
# Variance
var(penguins$bill_length_mm)
# Standard deviation
sd(penguins$bill_length_mm)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment