use %||% from rlang

This commit is contained in:
pvictor 2021-11-17 11:45:05 +01:00
parent fe45564f6a
commit 0f7ec49342
No known key found for this signature in database
GPG Key ID: 31124C9F3F9268B8
4 changed files with 5 additions and 6 deletions

View File

@ -95,6 +95,7 @@ importFrom(htmlwidgets,sizingPolicy)
importFrom(jsonlite,fromJSON)
importFrom(magrittr,"%>%")
importFrom(rlang,"!!")
importFrom(rlang,"%||%")
importFrom(rlang,as_label)
importFrom(rlang,eval_tidy)
importFrom(rlang,is_function)

View File

@ -118,6 +118,7 @@ apex <- function(data, mapping, type = "column", ...,
# Construct series
#' @importFrom rlang %||%
make_series <- function(mapdata, mapping, type = NULL, serie_name = NULL, force_datetime_names = FALSE) {
if (identical(type, "candlestick")) {
if (!all(c("x", "open", "high", "low", "close") %in% names(mapping)))
@ -271,7 +272,7 @@ range_num <- function(x) {
}
}
#' @importFrom rlang %||%
compute_count <- function(mapdata) {
if (!is_grouped(mapdata)) {
x <- mapdata$x

View File

@ -38,7 +38,7 @@ n_facet <- function(l) {
Reduce(`*`, l)
}
#' @importFrom rlang %||%
set_scale <- function(ax, values, scales = c("fixed", "free", "free_y", "free_x"), axis = c("x", "y")) {
if (is.null(scales))
return(ax)
@ -289,6 +289,7 @@ ax_facet_grid <- function(ax,
# Tag ---------------------------------------------------------------------
#' @importFrom rlang %||%
build_facet_tag <- function(x) {
facets <- build_facets(x)
content <- facets$facets

View File

@ -12,10 +12,6 @@ dropNulls <- function(x) {
x[!vapply(x, is.null, FUN.VALUE = logical(1))]
}
`%||%` <- function(x, y) {
if (!is.null(x)) x else y
}
formatNoSci <- function(x) {
if (is.null(x)) return(NULL)
format(x, scientific = FALSE, digits = 15)