Skip to content

Commit d0417c3

Browse files
committed
collect bin utilities in one place
1 parent 3933a92 commit d0417c3

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

R/bin.R

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,18 @@ bin_out <- function(count = integer(0), x = numeric(0), width = numeric(0),
225225
)
226226
}
227227

228+
bin_loc <- function(x, id) {
229+
left <- x[-length(x)]
230+
right <- x[-1]
231+
232+
list(
233+
left = left[id],
234+
right = right[id],
235+
mid = ((left + right) / 2)[id],
236+
length = diff(x)[id]
237+
)
238+
}
239+
228240
fix_bin_params = function(params, fun, version) {
229241

230242
if (!is.null(params$origin)) {

R/stat-bin2d.R

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -128,15 +128,3 @@ bin2d_breaks <- function(scale, breaks = NULL, origin = NULL, binwidth = NULL,
128128
}
129129
bins(breaks, closed)$fuzzy
130130
}
131-
132-
bin_loc <- function(x, id) {
133-
left <- x[-length(x)]
134-
right <- x[-1]
135-
136-
list(
137-
left = left[id],
138-
right = right[id],
139-
mid = ((left + right) / 2)[id],
140-
length = diff(x)[id]
141-
)
142-
}

0 commit comments

Comments
 (0)