Skip to content

Commit 36a9ee3

Browse files
bhaskarvkjcheng5
authored andcommitted
Changed all abcd = function(..) to abcd <- function(..) (#334)
1 parent c62fedc commit 36a9ee3

15 files changed

+139
-138
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ inst/htmlwidgets/sources
66
*.swp
77
inst/examples/rsconnect
88
inst/examples/*.html
9+
R/tags

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: leaflet
22
Type: Package
33
Title: Create Interactive Web Maps with the JavaScript 'Leaflet' Library
4-
Version: 1.0.2.9008
4+
Version: 1.0.2.9009
55
Date: 2016-11-03
66
Authors@R: c(
77
person("Joe", "Cheng", email = "[email protected]", role = c("aut", "cre")),

R/colors.R

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#' \code{alpha=TRUE} in which case #RRGGBBAA may also be possible).
3131
#'
3232
#' @export
33-
colorNumeric = function(palette, domain, na.color = "#808080", alpha = FALSE) {
33+
colorNumeric <- function(palette, domain, na.color = "#808080", alpha = FALSE) {
3434
rng = NULL
3535
if (length(domain) > 0) {
3636
rng = range(domain, na.rm = TRUE)
@@ -57,14 +57,14 @@ colorNumeric = function(palette, domain, na.color = "#808080", alpha = FALSE) {
5757

5858
# Attach an attribute colorType to a color function f so we can derive legend
5959
# items from it
60-
withColorAttr = function(type, args = list(), fun) {
60+
withColorAttr <- function(type, args = list(), fun) {
6161
structure(fun, colorType = type, colorArgs = args)
6262
}
6363

6464
# domain may or may not be NULL.
6565
# Iff domain is non-NULL, x may be NULL.
6666
# bins is non-NULL. It may be a scalar value (# of breaks) or a set of breaks.
67-
getBins = function(domain, x, bins, pretty) {
67+
getBins <- function(domain, x, bins, pretty) {
6868
if (is.null(domain) && is.null(x)) {
6969
stop("Assertion failed: domain and x can't both be NULL")
7070
}
@@ -97,7 +97,7 @@ getBins = function(domain, x, bins, pretty) {
9797
#' to generate the bins and the breaks may not be "pretty".
9898
#' @rdname colorNumeric
9999
#' @export
100-
colorBin = function(palette, domain, bins = 7, pretty = TRUE,
100+
colorBin <- function(palette, domain, bins = 7, pretty = TRUE,
101101
na.color = "#808080", alpha = FALSE) {
102102

103103
# domain usually needs to be explicitly provided (even if NULL) but not if
@@ -132,7 +132,7 @@ colorBin = function(palette, domain, bins = 7, pretty = TRUE,
132132
#' argument is ignored.
133133
#' @rdname colorNumeric
134134
#' @export
135-
colorQuantile = function(palette, domain, n = 4,
135+
colorQuantile <- function(palette, domain, n = 4,
136136
probs = seq(0, 1, length.out = n + 1), na.color = "#808080", alpha = FALSE) {
137137

138138
if (!is.null(domain)) {
@@ -161,7 +161,7 @@ colorQuantile = function(palette, domain, n = 4,
161161

162162
# If already a factor, return the levels. Otherwise, convert to factor then
163163
# return the levels.
164-
calcLevels = function(x, ordered) {
164+
calcLevels <- function(x, ordered) {
165165
if (is.null(x)) {
166166
NULL
167167
} else if (is.factor(x)) {
@@ -173,7 +173,7 @@ calcLevels = function(x, ordered) {
173173
}
174174
}
175175

176-
getLevels = function(domain, x, lvls, ordered) {
176+
getLevels <- function(domain, x, lvls, ordered) {
177177
if (!is.null(lvls))
178178
return(lvls)
179179

@@ -195,7 +195,7 @@ getLevels = function(domain, x, lvls, ordered) {
195195
#' factor, treat it as already in the correct order
196196
#' @rdname colorNumeric
197197
#' @export
198-
colorFactor = function(palette, domain, levels = NULL, ordered = FALSE,
198+
colorFactor <- function(palette, domain, levels = NULL, ordered = FALSE,
199199
na.color = "#808080", alpha = FALSE) {
200200

201201
# domain usually needs to be explicitly provided (even if NULL) but not if
@@ -268,18 +268,18 @@ colorFactor = function(palette, domain, levels = NULL, ordered = FALSE,
268268
NULL
269269

270270

271-
safePaletteFunc = function(pal, na.color, alpha) {
271+
safePaletteFunc <- function(pal, na.color, alpha) {
272272
toPaletteFunc(pal, alpha=alpha) %>% filterRGB() %>% filterZeroLength() %>%
273273
filterNA(na.color) %>% filterRange()
274274
}
275275

276-
toPaletteFunc = function(pal, alpha) {
276+
toPaletteFunc <- function(pal, alpha) {
277277
UseMethod("toPaletteFunc")
278278
}
279279

280280
# Strings are interpreted as color names, unless length is 1 and it's the name
281281
# of an RColorBrewer palette
282-
toPaletteFunc.character = function(pal, alpha) {
282+
toPaletteFunc.character <- function(pal, alpha) {
283283
if (length(pal) == 1 && pal %in% row.names(RColorBrewer::brewer.pal.info)) {
284284
return(scales::colour_ramp(
285285
RColorBrewer::brewer.pal(RColorBrewer::brewer.pal.info[pal, 'maxcolors'], pal),
@@ -291,12 +291,12 @@ toPaletteFunc.character = function(pal, alpha) {
291291
}
292292

293293
# Accept colorRamp style matrix
294-
toPaletteFunc.matrix = function(pal, alpha) {
294+
toPaletteFunc.matrix <- function(pal, alpha) {
295295
toPaletteFunc(rgb(pal, maxColorValue = 255), alpha = alpha)
296296
}
297297

298298
# If a function, just assume it's already a function over [0-1]
299-
toPaletteFunc.function = function(pal, alpha) {
299+
toPaletteFunc.function <- function(pal, alpha) {
300300
pal
301301
}
302302

@@ -306,7 +306,7 @@ toPaletteFunc.function = function(pal, alpha) {
306306
#' @param values A set of values to preview colors for
307307
#' @return An HTML-based list of the colors and values
308308
#' @export
309-
previewColors = function(pal, values) {
309+
previewColors <- function(pal, values) {
310310
heading = htmltools::tags$code(deparse(substitute(pal)))
311311
subheading = htmltools::tags$code(deparse(substitute(values)))
312312

@@ -336,7 +336,7 @@ previewColors = function(pal, values) {
336336

337337
# colorRamp(space = 'Lab') throws error when called with
338338
# zero-length input
339-
filterZeroLength = function(f) {
339+
filterZeroLength <- function(f) {
340340
force(f)
341341
function(x) {
342342
if (length(x) == 0) {
@@ -348,7 +348,7 @@ filterZeroLength = function(f) {
348348
}
349349

350350
# Wraps an underlying non-NA-safe function (like colorRamp).
351-
filterNA = function(f, na.color) {
351+
filterNA <- function(f, na.color) {
352352
force(f)
353353
function(x) {
354354
results = character(length(x))
@@ -360,7 +360,7 @@ filterNA = function(f, na.color) {
360360
}
361361

362362
# Wraps a function that may return RGB color matrix instead of rgb string.
363-
filterRGB = function(f) {
363+
filterRGB <- function(f) {
364364
force(f)
365365
function(x) {
366366
results = f(x)
@@ -374,7 +374,7 @@ filterRGB = function(f) {
374374
}
375375
}
376376

377-
filterRange = function(f) {
377+
filterRange <- function(f) {
378378
force(f)
379379
function(x) {
380380
x[x < 0 | x > 1] = NA

R/controls.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#'
77
#' @describeIn map-layers Add arbitrary HTML controls to the map
88
#' @export
9-
addControl = function(
9+
addControl <- function(
1010
map, html, position = c('topleft', 'topright', 'bottomleft', 'bottomright'),
1111
layerId = NULL, className = "info legend", data = getMapData(map)
1212
) {
@@ -22,13 +22,13 @@ addControl = function(
2222

2323
#' @export
2424
#' @rdname remove
25-
removeControl = function(map, layerId) {
25+
removeControl <- function(map, layerId) {
2626
invokeMethod(map, NULL, 'removeControl', layerId)
2727
}
2828

2929
#' @export
3030
#' @rdname remove
31-
clearControls = function(map) {
31+
clearControls <- function(map) {
3232
invokeMethod(map, NULL, 'clearControls')
3333
}
3434

0 commit comments

Comments
 (0)