我在伦敦有一些基本的房价数据。
我有数据的子集
Y2018 = subset(HP, Date == "2018" & PPDCategory.Type == "A")
然后,我生成了交易价格的平均值,中位数,最大值和最小值。
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))
这显然现在将第一列显示为“ tapply(Y2018 $ Price,Y2018 $ Ward,na.rm = TRUE,中位数)”-使该列名称存储为“中位数”的正确方法是什么。 / p>
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
答案 0 :(得分:0)