With a constructor

Type initialization / Structures

# A structure: a named list built by a function
new_size <- function(width, height) {
  list(width = width, height = height)
}

new_point <- function(top, left) {
  list(top = top, left = left)
}

new_rectangle <- function(size, point) {
  list(size = size, point = point)
}

size <- new_size(10, 10)
# Arguments by name
point <- new_point(top = 5, left = 5)
rect <- new_rectangle(size, point)

str(rect)