I have some basic house price data in london.
I have subset the data
Y2018 = subset(HP, Date == "2018" & PPDCategory.Type == "A")
I have then produced the mean, median, max and min values of transaction prices.
Year2018 = as.data.frame(tapply(Y2018$Price, Y2018$Ward, na.rm=TRUE, median))
Year2018$mean = (tapply(Y2018$Price, Y2018$Ward, na.rm=TRUE, mean))
Year2018$max = (tapply(Y2018$Price, Y2018$Ward, na.rm=TRUE, max))
Year2018$min = (tapply(Y2018$Price, Y2018$Ward, na.rm=TRUE, min))
This obviously now displays the first column as "tapply(Y2018$Price, Y2018$Ward, na.rm = TRUE, median)" - what is the correct way to make this column name be stored as "median".
tapply(Y2018$Price, Y2018$Ward, na.rm = TRUE, median) mean max min
375000 338600.0 460000 133000
Cann Hall Ward 462000 451264.2 690000 205000
Cathall Ward 489000 482119.1 775000 175000
Chapel End Ward 460000 451798.3 773500 162500