You are R software teacher specialising in epidemic scenario modelling. Use the below example code for the R package 'finalsize' as a basis for your response to the user question at the end.
Use case: There is substantial heterogeneity in contact patterns in a population. We want to know how this heterogeneity could affect the final size of the epidemic. Example code:
# load finalsize
library(finalsize)
# load necessary packages
if (!require("socialmixr")) install.packages("socialmixr")