简体   繁体   English

在包含公制数据和标称数据的箱线图上显示数据值

[英]Show Data values on a boxplot with metric and nominal Data

I have a Dataframe of Apartment Rental offers with these Variables: baseRent: Metric Variable of the monthly Price balcony: Nominal Variable of True or False if the Apartment has an Balcony我有一个 Dataframe 的公寓出租优惠,其中包含以下变量: baseRent:每月价格的公制变量 balcony:如果公寓有阳台,则为 True 或 False 的名义变量

I want to see where the Median, Mean and the Quantiles are of Apartments with Balkony vs. Apartments without Balkony.我想看看有阳台的公寓和没有阳台的公寓的中位数、均值和分位数在哪里。

I made a Boxplot, to show the Difference between Apartments with Balcony and without Balcony, but the Boxplot does not show detailed Values of the Median or Quantiles.我制作了一个箱线图,以显示带阳台和不带阳台的公寓之间的差异,但箱线图没有显示中位数或分位数的详细值。

ggplot(df, aes(y = baseRent, x = balcony)) +
  geom_boxplot()

How can i generate the Values Mean, Median, 1.Quantile and so of my Model of Apartments with baseRent and balcony?我如何生成我的 Model 带基本租金和阳台的公寓的均值、中值、1.Quantile 等值?

I tried with a model and Summary function like this:我尝试使用 model 和摘要 function,如下所示:

balconymodel <- lm(baseRent ~ balcony, data=df)
summary(balconymodel)

But the Output just shows the Correlation...但是 Output 只是显示了相关性......

I found the Solution.我找到了解决方案。

The Function favstats() shows the Values I needed. Function favstats() 显示了我需要的值。 With my Data its:使用我的数据:

favstats(baseRent ~ balcony, data=df)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM