User Tools

Site Tools


Translations of this page:

Back to BIS-Schools

Biodiversity data analysis with R






W12-1 Subsetting data frames

This worksheet goes back to the roots of this course and trains your skills in subsetting data frames. Subsetting summarizes the extraction of individual regions of a data frame (e.g. rows, columns, cells which values fulfill a certain logical expression etc.). After completing this worksheet you should know how to subset data frames using logical expressions.

Things you need for this worksheet

  • R — the interpreter can be installed on any operation system. For Linux, you should use the r-cran packages supplied for your Linux distribution. If you use Ubuntu, this is one of many starting points. If you use windows, you could install R from the official CRAN web page.

  • R Studio — we recommend to use R Studio for (interactive) programming with R. You can download R Studio from the official web page.

  • your script from W02-1: Reading CSV files

Learning log assignments

:!: First things first: the following analysis is build on top of your script from W02-1. Please copy your script “W02-1.R”, rename the copy to “W12-1.R” and use it for the programming tasks of this worksheet.

:-\ Please create subsets with the following attributes:

  • Rows with a coverage of more than 50%. Use squared brackets for a subset.
  • Rows with more natural species than agricultural.
  • Rows with exactly 3 natural species or 3 agricultural species.
  • Rows with a coverage less than 5% and elevation under 1800m.
  • Rows where animals where recorded.
en/learning/schools/s01/worksheets/ba-ws-12-1.txt · Last modified: 2015/09/22 16:22 (external edit)