Chapter 2: Working with Categorical Data
Summary
Creating and manipulating categorical data sets requires some skills and techniques in R beyond those ordinarily used for quantitative data. This chapter illustrates these for the main formats for categorical data: case form, frequency form and table form.Contents
- 2.1. Working with R data: vectors, matrices, arrays, and data frames
- 2.2. Forms of categorical data: case form, frequency form, and table form
- 2.3. Ordered factors and reordered tables
- 2.4. Generating tables: table and xtabs
- 2.5. Printing tables: structable and ftable
- 2.6. Subsetting data
- 2.7. Collapsing tables
- 2.8. Converting among frequency tables and data frames
- 2.9. A complex example: TV viewing data
- 2.10. Lab exercises