I am doing an exercise that says the following:
Make a boxplot of the mean age of the municipalities. What is the municipality with the highest average age?
And these are the columns that are used:
municipi = código postal del municipio y nombre del municipio,
edat = edad media de los habitantes del municipio,
pobl= número de habitantes del municipio,
prov = provincia a la que pertenece el municipio.
In R I do the boxplot like this:
boxplot(temp$edat)
Where temp
is the variable where I store the .csv data and edat
the average of the municipalities. This returns me the following:
But they ask me to name the municipality with the highest average age. So try the following:
boxplot(temp$edat ~ temp$municipi)
And it returns it to me in this way, which for me is unreadable, in addition to the fact that it does not show all the municipalities:
Is there any other way to solve the exercise? Or at least know which is the municipality
If you only have one age data per municipality (the average), the first boxplot is well done. As for the name of the municipality with the highest average age, you can obtain it like this: