Exercise

# Two nominal variables

It's important to understand which questions can be asked of different types of variables. In general, you can assess relationships between variables using comparison operators such as `==`

and `<`

and arithmetic operators such as `-`

and `*`

.

The `==`

operator tests equality between two variables (e.g. `"Tom" == "Mark"`

returns `FALSE`

). Be careful not to confuse this with `=`

, which can be used to assign values! The `<`

operator asks whether one variable is less than another (e.g. `4 < 6`

returns `TRUE`

). Finally, the minus sign (`-`

) calculates the difference between two variables (e.g. `5 - 3`

returns `2`

). Of course, **not all of these operations are valid for every variable type**.

Recall the survey example from earlier in the chapter. The labels you created to mask the identities of family members, `participants2`

, are nominal variables. We've extracted the first two elements of `participants2`

and made them available in your workspace in `lab1`

and `lab2`

.

Which of questions can you ask of the *nominal variables* `lab1`

and `lab2`

?

Instructions

**50 XP**

##### Possible Answers

- Is
`lab1`

equal to`lab2`

? - Is
`lab1`

less than`lab2`

? - How much greater is
`lab1`

than`lab2`

? - All of the above