Skip to content

university-of-oxford-international-health-and-tropical-medicine-2026-basic-operations-in-r-basic-ope created by GitHub Classroom

Notifications You must be signed in to change notification settings

OxfordIHTM/basic-operations-in-r-2026

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Performing basic operations in R

In this exercise/assignment, we will learn how to perform basic operations using R while at the same time familiarising ourselves with using RStudio and with using a project-orientated R workflow.

For this exercise, we will use body mass index or BMI as our topic of interest and will use R in performing BMI calculations.

Problem 1: Calculating BMI for a single persion given weight and height

Given a person with a weight of 80 kilograms and a height of 1.6 metres, calculate BMI using R.

Knowledge and skill items to think about and find out:

  • What is the formula for calculating BMI? What are the typical/standard units used for weight and height for this calculation?

  • What are the arithmetic/mathematical operations expressed in the BMI formula? What symbols or syntax are used in R to perform the operations in the BMI formula?

  • How to issue the command/instructions to R to perform the operations to calculate BMI?

  • How to record/store the output of the command/instructions issued to R to perform the operations to calculate BMI?

  • How to record/store/save the command/instructions issued to R to perform the operations to calculate BMI?

Problem 2: Testing relationships between two values

Say we have Person A with a weight of 80 kilograms and a height of 1.6 metres and Person B with a weight of 120 kilograms and a height of 210 centimetres.

In R, try to answer the following questions:

  1. Is Person A heavier in weight compared to Person B?

  2. Is Person A taller in height compared to Person B?

  3. Whose BMI is greater, Person A or Person B?

Problem 3: Testing combined or compound relationships

In R, answer the following questions using logical operators:

  1. Is the weight of Person A AND the weight of Person B both equal to 80 kilograms?

  2. Is the weight of Person A OR the weight of Person B less than 100 kilograms?

  3. Is the weight of Person A greater than the weight of Person B AND the height of Person A greater than the height of Person B?

  4. Is the weight of Person A greater than the weight of Person B OR the height of Person A greater than the height of Person B?

About

university-of-oxford-international-health-and-tropical-medicine-2026-basic-operations-in-r-basic-ope created by GitHub Classroom

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages