Primary exercises
- For weight and height measurements we have the
metric
(cm,kg) and imperial
(inch,lbs) systems. The relation
between the measurements in different systems is (1 kg = 2.2 lbs) and (1
inch = 2.54 cm). Write the following unit conversion functions:
- cm2meter : convert cm to meter
- lbs2kg : convert weight unit pound to kg
- inch2cm : convert inch to cm
# Some example calls to the functions:
> inch2cm(70)
[1] 177.8
> lbs2kg(10)
[1] 4.545455
> cm2m(190)
[1] 1.9
- Write a function for the survey dataset to report a summary on
average pulse and the number of individuals in the given age range. Call
it
ageRangePulseSummary
and it should take 3 arguments, the
survey data, minimum age and maximum age, for example:
ageRangePulseSummary(survey, 16,17)
# A tibble: 1 × 2
meanpulse individuals
<dbl> <int>
1 76.2 4
- Take the function
weightRangeSummary
in the lecture
notes, make the necessary update such that it includes the weight
intervals.
Copyright © 2024 Biomedical Data Sciences (BDS) | LUMC