Chapter 4 Manage datasets
The previous chapter covered how to manage variables within a dataset. In this chapter, you will learn how to manage one or more datasets, including the following tasks:
- Select a subset of variables,
- Select a subset of observations,
- Exclude observations with missing data,
- Sort a dataset by values of one or more variables,
- Append (stacking) multiple datasets, and
- Merge (joining) multiple datasets.
We will use the same dataset as in the previous chapter.
load("Data/RheumArth-Chapter3.RData")
library(tidyverse)
$Sex[mydat$Sex %in% c("f", "female")] <- "F"
mydat$Sex[mydat$Sex == "m" ] <- "M"
mydat<- as_tibble(mydat) mydat_tibble