Exercise

# Selecting Vector Elements Using Gender.

Do you remember the `workshop`

vector of the slides, which contained the answers on the question: "Which workshop did you take?"? The value `1`

stood for SAS, `2`

for R. The vector `gender`

contains the data of the same persons as with the `workshop`

vector but for the question: "What is your gender?". The result is seen in the editor on the right. `"f"`

stands for female, `"m"`

for male and `NA`

represents a missing value.

A third vector, namely `q1`

contains the scores of the persons on the statement: "The instructor was well prepared". `1`

stands for "strongly disagree", `5`

stands for "strongly agree".

Compare the mean score of the males on `q1`

with the mean score of the females on `q1`

.

Instructions

**100 XP**

- Select the scores of the males in
`q1`

by using square brackets and a logical operator. - Apply the
`summary()`

function to the selection to get the mean. - Select the scores of the females in
`q1`

by using square brackets and a logical operator. - Apply the
`summary()`

function to the selection to get the mean. - Compare the two means. Which one is the highest?