

We’ll place the results in a user-defined R object so that we can reuse it in the next section without re-writing the complete pipeline. For each marital status code, we’ll then count how many women and men are in each category that we’ll report in columns Mnum and Wnum (the sum of these 2 on each line should be equal to the reported Counts column.)įor simplicity with income and education we’ll simply compute the mean of the codes, which should still give us an indication of the level of income and education for each category of marital status.

We want to get some information by group, in this case we’ll group by marital status and then count the total number of observations for each case and we’ll store this in column Counts.
Rstudio ifelse how to#

4.6.3 Combining vectors to create a matrix.4.3.5 Working directory: getwd() and setwd().2.3 Working with R: objects and workspace.Tabular data analysis with R and Tidyverse: NHANES Environmental Health Datasets.
