This document discusses various methods for subsetting and manipulating data in R, including:
- Using the subset function to extract rows from a data frame based on logical expressions involving column names.
- Logical subsetting using comparison operators like ==, | (OR), & (AND) to extract rows meeting certain criteria.
- Selecting and removing specific columns from a data frame.
- Using the which() function to identify row positions meeting a condition and subset based on the indices.
- Sorting data using the order() function.
- Calculating aggregates like means using the aggregate() function across groups defined by other variables.
- Creating contingency tables using the table() and xt