Skip to content

Instantly share code, notes, and snippets.

@lundquist-ecology-lab
Last active February 16, 2023 18:41
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/e51c65c9f15de7fd360a7cbe40b92b03 to your computer and use it in GitHub Desktop.
Save lundquist-ecology-lab/e51c65c9f15de7fd360a7cbe40b92b03 to your computer and use it in GitHub Desktop.
How to subset data in R
# Subsetting data in R
# Subset Iris data into a dataframe with only one species
virginica <- subset(iris, iris$Species == "virginica")
# Subset a particular vector with only the values from a particular group
virginica_sepals <- iris$Sepal.Length[iris$Species == "virginica"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment