, -, , . , ggplot2_2.0.0. , , boundary.
df <- data.frame(var = seq(-100,100,10)/100)
as.list(df) # check the data
$var
[1] -1.0 -0.9 -0.8 -0.7 -0.6 -0.5 -0.4 -0.3 -0.2
[10] -0.1 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7
[19] 0.8 0.9 1.0
library("ggplot2")
p <- ggplot(data = df, aes(x = var)) +
geom_histogram(aes(y = ..count..),
binwidth = 0.1,
boundary = 0.1,
closed = "left")
p

boundary. 1, 0,99. .
ggplot(data = df, aes(x = var)) +
geom_histogram(aes(y = ..count..),
binwidth = 0.05,
boundary = 0.99,
closed = "left")
( )

, . 1 , (. eps). ggplot2 1-7 ( ) 1-8 ( ).
:
ncount:
str(ggplot_build(p)$data[[1]])
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
ggplot_build(p)$data[[1]]$ncount
#
#
?
:
df <- data.frame(var = as.integer(seq(-100,100,10)))
eps <- 1+10*.Machine$double.eps
p <- ggplot(data = df, aes(x = eps*var/100)) +
geom_histogram(aes(y = ..count..),
binwidth = 0.05,
closed = "left")
p
( boundary)

ggplot2_1.0.1. , . bin.R stat-bin.r https://github.com/hadley/ggplot2/blob/master/R, count bin_vector(), :
bin_vector <- function(x, bins, weight = NULL, pad = FALSE) {
... STUFF HERE I HAVE DELETED FOR CLARITY ...
cut(x, bins$breaks, right = bins$right_closed,
include.lowest = TRUE)
... STUFF HERE I HAVE DELETED FOR CLARITY ...
}
, ... ...
"patching" bin_vector :
bins$fuzzy
- bins$breaks, ( , ), bins$fuzzy .
bins$breaks bins$fuzzy bin_vector, . , , , , , ggplot2.
bin_vector , bins$breaks, bins$fuzzy. , .
Patching
"patch" bin_vector, github , , , :
ggplot2:::bin_vector
( ) :
library("ggplot2")
bin_vector <- function (x, bins, weight = NULL, pad = FALSE)
{
... STUFF HERE I HAVE DELETED FOR CLARITY ...
bin_idx <- cut(x, bins$fuzzy, right = bins$right_closed,
include.lowest = TRUE)
... STUFF HERE I HAVE DELETED FOR CLARITY ...
ggplot2:::bin_out(bin_count, bin_x, bin_widths)
}
assignInNamespace("bin_vector", bin_vector, ns = "ggplot2")
df <- data.frame(var = seq(-100,100,10)/100)
ggplot(data = df, aes(x = var)) + geom_histogram(aes(y = ..count..), binwidth = 0.05, boundary = 1, closed = "left")
, : , , . , R detach ggplot2.
2.0.9.3 2.1.0.1 2.2.0.1 (, , 2.2.0.0), ).
, ggplot2_0.9.3, ( ), ggplot2093:
URL <- "http://cran.r-project.org/src/contrib/Archive/ggplot2/ggplot2_0.9.3.tar.gz"
install.packages(URL, repos = NULL, type = "source",
lib = "~/R/testing/ggplot2093")
, :
library("ggplot2", lib.loc = "~/R/testing/ggplot2093")