I have a data frame that consists of multiple columns. Each column represents a day in a year (I have 365 columns) and each row is the mean temperature of a specific city. I would like to get the mean of all columns, so I get a mean of temperature for the entire year. I would also like to get the mean of each month (that is mean of 01(January), 02(February), and so on), and also get the mean per quarter of a year.
My data looks something like this
data <- data.frame(City = c("London", "Stockholm", "Paris", "Prag", "Berlin", "Copenhagen"),
20100101 = c(4, 5, 3, 4, 6, 7), 20100102 = c(2, 5, 8, 6, 1, 3),
20100205 = c(4, 7, 6, 1, 3, 4), 20100305 = c(0, 3, 7, 9, 3, 2),
20100525 = c(9, 8, 7, 6, 5, 4), 20100719 = c(9, 10, 5, 6, 7, 8),
20101011 = c(15, 3, 5, 7, 8, 9), 20101112 = c(3, 7, 1, 1, 1, 1),
20101212 = c(0, 0, 0, 5, 2, 1))
How can I extract the mean of the year, each month, and each quarter of a year?