有人能向我解释为什么我得到不同数量的outliers与正常箱线图命令,并与geom_boxplot中GGPLOT2?这里有一个例子:
x <- c(280.9, 135.9, 321.4, 333.7, 0.2, 71.3, 33.0, 102.6, 126.8, 194.8, 35.5,
107.3, 45.1, 107.2, 55.2, 28.1, 36.9, 24.3, 68.7, 163.5, 0.8, 31.8, 121.4,
84.7, 34.3, 25.2, 101.4, 203.2, 194.1, 27.9, 42.5, 47.0, 85.1, 90.4, 103.8,
45.1, 94.0, 36.0, 60.9, 97.1, 42.5, 96.4, 58.4, 174.0, 173.2, 164.1, 92.1,
41.9, 130.2, 94.7, 121.5, 261.4, 46.7, 16.3, 50.7, 112.9, 112.2, 242.5, 140.6,
112.6, 31.2, 36.7, 97.4, 140.5, 123.5, 42.9, 59.4, 94.5, 37.4, …Run Code Online (Sandbox Code Playgroud) 我有一个像ggplot2这样的分组箱图
p <- qplot(factor(cyl), mpg, data=mtcars, geom="boxplot", fill=factor(gear))
Run Code Online (Sandbox Code Playgroud)
我想透支平均点数.我试过这个
p+ stat_summary(fun.y=mean, colour="red", geom="point")
Run Code Online (Sandbox Code Playgroud)
但是,我没有得到每组的平均分.

我该怎么做才能得到这个?
在像下面这样的图表中,我想将千位分隔符更改为点“.”,但我不知道如何使用该tickformat参数来获取它。
require(plotly)
p <- plot_ly(x=~c(2012,2013,2014,2015,2016), y=~c(1200000,975000,1420000,1175000,1360000), type='bar') %>%
layout(yaxis = list(title="Income in €", tickformat=",d", gridcolor = "#bbb"), xaxis = list(title="Year"), margin=list(l=80))
p
Run Code Online (Sandbox Code Playgroud)
我正在使用R包leaftlet创建带有一些标记的地图,但我还需要在地图上显示移动设备的GPS位置.
我知道这可能在使用location方法和一些javascript的传单中,但似乎这个方法在R包中不可用:"leaflet".
在用R和传单生成的地图中显示GPS位置的最佳方法是什么?
我有以下数据
set.seed(123)
x = c(rnorm(100, 4, 1), rnorm(100, 6, 1))
gender = rep(c("Male", "Female"), each=100)
mydata = data.frame(x=x, gender=gender)
Run Code Online (Sandbox Code Playgroud)
我想用 ggplot 绘制两个累积直方图(一个用于男性,另一个用于女性)。我已经尝试过下面的代码
ggplot(data=mydata, aes(x=x, fill=gender)) + stat_bin(aes(y=cumsum(..count..)), geom="bar", breaks=1:10, colour=I("white")) + facet_grid(gender~.)
Run Code Online (Sandbox Code Playgroud)
但我得到了这张图表
显然,这是不正确的。
我怎样才能得到正确的,像这样:
谢谢!
我怎么能得到像这样的累积直方图
x <- runif(100,0,10)
h <- hist(x)
h[["counts"]] <- cumsum(h[["counts"]])
plot(h)
Run Code Online (Sandbox Code Playgroud)
用ggplot2?
我也想画这样的多边形
lines(h[["breaks"]],c(0,h[["counts"]]))
Run Code Online (Sandbox Code Playgroud)

我用ggplot2像这样做了一个刻面的饼图:
qplot(x=factor(1), data=mtcars, fill=factor(cyl)) +
geom_bar(width=1) +
coord_polar(theta="y") +
facet_grid(~gear)
Run Code Online (Sandbox Code Playgroud)

但由于所有的饼图共享y轴刻度,其中一些不覆盖整个圆圈.我试过facet_grid(~gear, scales="free")但它不起作用.
我怎么能得到所有饼图的完整圆圈?