When preparing a dataset for statistical analysis, data processing and manipulations, such as checking, cleaning, and creating new variables, are two important tasks. In this chapter, the basics of data manipulation will be discussed with examples that will give us an idea about checking a dataset, and cleaning it, if necessary.
This chapter will deal with the following topics:
Acquiring data
Vector and matrix operations
Factor manipulations
Factors from numeric variables
Date processing using lubridate
Character and string manipulations
Subscripting and subsetting datasets