Primary exercises

In the survey data:

  1. Take a look at the table with glimpse and inspect its dimensions and types.

  2. Summarise on mean hand spans {span1,span2} and median pulse.

  3. Summarise on mean age and median height.

  4. Count the number of males and females.

  5. Produce the frequency tables on {gender, fold} and {gender, fold, clap}.

  6. Produce the frequency table on gender and smokes, show only females.

  7. Summarise median age of male heavy smokers. Do the same for females.

Extra exercises

  1. Produce the frequency table on gender, exercise and smokes but only for male smokers.

  2. Do individuals all have different names? Put differently, is each observation uniquely identifiable with the variable name?

  3. Find pairs of variables which can uniquely identify each observation. Use name and one other variable for this purpose.

  4. An alternative solution for the primary exercise (6) is solution (2) below:

# solution (1)
survey %>% count(gender,smokes) %>% filter(gender=="female") 
# solution (2)
survey %>% filter(gender=="female") %>% count(gender,smokes)

where first filter is applied and then count. You may check the results and see that the outcomes are identical. Explain the difference between the two solutions.



Copyright © 2023 Biomedical Data Sciences (BDS) | LUMC