Exercise: Introduction and Basic Functions in R

In this exercise, we’ll start with the basics of R, focusing on arithmetic operations.

1. Please follow the instructions at Course Unit 01: Installation and install both R and RStudio.

2. Use R to
a) calculate the sum and product of the numbers 3, 7, 9, 12, and 21. Explore R’s help features to find an alternative solutions.
b) Calculate the square root of 2025.

3.
Define the population and area for Region A and Region B
population_A <- 1500000 # Population of Region A
area_A <- 2500 # Area of Region A in square kilometers
population_B <- 800000 # Population of Region B
area_B <- 1200 # Area of Region B in square kilometers
Calculate the population density for Region A and Region B

The formula for population density is:

Updated: