The History of Lego

Lego was founded in 1932 and was one of my favourite childhood toys. Getting a lego set at christmas and putting it together was always a highlight of my year. This dataset provides data on every lego set that has ever been sold. It is available at https://rebrickable.com/downloads/.

Throughout this I will be using dplyr, ggplot2 and plotly.

Parts per Year

To see the parts per year of all the lego sets we first need to aggregate the dataframe and call this parts_by_year.

parts_by_year <- aggregate(data_with_themes$num_parts, by=list(Year=data_with_themes$year), FUN=sum)

This plot shows the total number of parts in all of the sets released in a given year.

Sets Released per Year

To count the amount of sets released per year we will first add a column of 1’s, and then aggregate and sum for each year.

data_with_themes$num_sets <- 1
sets_by_year <- aggregate(data_with_themes$num_sets, by=list(Year=data_with_themes$year), FUN=sum)
sets_by_year <- sets_by_year[-c(70),]

Here I have removed the year 2020 as this is an incomplete year.

We can clearly see a trend of lego releasing more sets every year, adding a geom_smooth parameter to this plot clearly illustrates this.

Average Parts per Set

Combining the previous two, we will be able to see if lego are relasing sets that on average have more parts.

Again, by adding a trend line we can illustrate the upward trend.

Most Common Lego Spare Brick

When you buy a lego set, they sometimes provide spares for some of the bricks. Using the database, we can see which brick comes with spares the most.

We can see that the majority of these bricks are small and more prone to be lost. These are the two most common spare bricks.

Plate Round 1 x 1

Plate Round 1 x 1

Slope 1 x 1 x 2/3

Slope 1 x 1 x 2/3

Most Common Lego Brick Category

With the most common bricks being the 1x2 brick and the 1x2 plate it is also no surprise that the two most common lego categories are bricks and plates as well. Technic pins are the 4th most common brick which shows that lego are releasing a lot more Technic themed sets.

The Colours of Lego

Brickable also provides a database of all the colours of the bricks. By merging the two data frames we can also make use of the name and hex value of the colour of each brick. Some lego bricks are translucent, and they have not been included in this first plot.

By far the most common colour is black, with nearly double the amount of bricks compared to the next colour, white. Red, blue, yellow and grey are also very prominent colours in lego sets.

Translucent Colours

This plot includes only the translucent colours, shwoing that clear (see-through) is the most common, followed by red and yellow.