This chapter offers a pragmatic exploration of data manipulation, addressing the often-messy realities of working with real-world datasets. It introduces foundational techniques for managing and preparing data, such as tabulating and cross-tabulating variables, using logical expressions, transforming variables, and extracting subsets of data. To provide clear and accessible examples, the chapter relies on small, illustrative datasets rather than complex real-world ones. Readers are encouraged to focus on grasping the basics, as this chapter serves more as a resource to revisit when encountering specific challenges rather than a comprehensive guide. Despite its practical nature, the chapter maintains a pedagogical approach, ensuring clarity in each technique.
The topics covered span a broad range of common tasks in data analysis. These include creating frequency tables, working with logical operators, and transforming variables using mathematical functions such as logarithms and exponentials. Additionally, it addresses the pragmatic need to collapse variables into discrete categories and to create reusable transformations for consistent application across datasets. While the content may initially seem overwhelming, readers are reassured that mastery of every detail is unnecessary for progressing through the book. Instead, the focus is on building a toolkit for real-world data challenges, with this chapter serving as a valuable reference for practical, hands-on data manipulation.