Skip to content

Commit c344dc8

Browse files
committed
fix silly lintr complaints
1 parent 30943e1 commit c344dc8

File tree

2 files changed

+33
-7
lines changed

2 files changed

+33
-7
lines changed

R/rlistings.R

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,12 @@ get_keycols <- function(df) {
284284
#' @export
285285
setMethod(
286286
"matrix_form", "listing_df",
287-
rix_form <- function(obj, indent_rownames = FALSE, expand_newlines = TRUE, fontspec = font_spec, col_gap = 3L, round_type = c("iec", "sas")) {
287+
rix_form <- function(obj,
288+
indent_rownames = FALSE,
289+
expand_newlines = TRUE,
290+
fontspec = font_spec,
291+
col_gap = 3L,
292+
round_type = c("iec", "sas")) {
288293
## we intentionally silently ignore indent_rownames because listings have
289294
## no rownames, but formatters::vert_pag_indices calls matrix_form(obj, TRUE)
290295
## unconditionally.
@@ -306,7 +311,10 @@ setMethod(
306311
for (i in seq_along(keycols)) {
307312
kcol <- keycols[i]
308313
kcolvec <- listing[[kcol]]
309-
kcolvec <- vapply(kcolvec, format_value, "", format = obj_format(kcolvec), na_str = obj_na_str(kcolvec), round_type = round_type)
314+
kcolvec <- vapply(kcolvec, format_value, "",
315+
format = obj_format(kcolvec),
316+
na_str = obj_na_str(kcolvec),
317+
round_type = round_type)
310318
curkey <- paste0(curkey, kcolvec)
311319
disp <- c(TRUE, tail(curkey, -1) != head(curkey, -1))
312320
bodymat[disp, kcol] <- kcolvec[disp]
@@ -316,7 +324,10 @@ setMethod(
316324
if (length(nonkeycols) > 0) {
317325
for (nonk in nonkeycols) {
318326
vec <- listing[[nonk]]
319-
vec <- vapply(vec, format_value, "", format = obj_format(vec), na_str = obj_na_str(vec), round_type = round_type)
327+
vec <- vapply(vec, format_value, "",
328+
format = obj_format(vec),
329+
na_str = obj_na_str(vec),
330+
round_type = round_type)
320331
bodymat[, nonk] <- vec
321332
}
322333
}

R/rlistings_methods.R

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,14 @@ dflt_courier <- font_spec("Courier", 9, 1)
1414
#'
1515
#' @export
1616
#' @name listing_methods
17-
print.listing_df <- function(x, widths = NULL, tf_wrap = FALSE, max_width = NULL, fontspec = NULL, col_gap = 3L, round_type = c("iec", "sas"), ...) {
17+
print.listing_df <- function(x,
18+
widths = NULL,
19+
tf_wrap = FALSE,
20+
max_width = NULL,
21+
fontspec = NULL,
22+
col_gap = 3L,
23+
round_type = c("iec", "sas"),
24+
...) {
1825
tryCatch({
1926
cat(
2027
toString(
@@ -42,7 +49,12 @@ print.listing_df <- function(x, widths = NULL, tf_wrap = FALSE, max_width = NULL
4249
#' @exportMethod toString
4350
#' @name listing_methods
4451
#' @aliases toString,listing_df-method
45-
setMethod("toString", "listing_df", function(x, widths = NULL, fontspec = NULL, col_gap = 3L, round_type = c("iec", "sas"), ...) {
52+
setMethod("toString", "listing_df", function(x,
53+
widths = NULL,
54+
fontspec = NULL,
55+
col_gap = 3L,
56+
round_type = c("iec", "sas"),
57+
...) {
4658
toString(
4759
matrix_form(x, fontspec = fontspec, col_gap = col_gap, round_type = round_type),
4860
fontspec = fontspec,
@@ -95,7 +107,9 @@ format_colvector <- function(df, colnm, colvec = df[[colnm]], round_type = c("ie
95107
#' needed to render the elements of `vec` to width `max_width`.
96108
#'
97109
#' @keywords internal
98-
setGeneric("vec_nlines", function(vec, max_width = NULL, fontspec = dflt_courier, round_type = c("iec", "sas")) standardGeneric("vec_nlines"))
110+
setGeneric("vec_nlines", function(vec, max_width = NULL, fontspec = dflt_courier, round_type = c("iec", "sas")) {
111+
standardGeneric("vec_nlines")
112+
})
99113

100114
#' @param vec (`vector`)\cr a vector.
101115
#'
@@ -108,7 +122,8 @@ setMethod("vec_nlines", "ANY", function(vec, max_width = NULL, fontspec = dflt_c
108122
# NB: flooring as it is used as <= (also in base::strwrap)
109123
}
110124
# in formatters for characters
111-
unlist(lapply(format_colvector(colvec = vec, round_type = round_type), nlines, max_width = max_width, fontspec = fontspec))
125+
unlist(lapply(format_colvector(colvec = vec, round_type = round_type), nlines,
126+
max_width = max_width, fontspec = fontspec))
112127
})
113128

114129
## setMethod("vec_nlines", "character", function(vec, max_width = NULL) {

0 commit comments

Comments
 (0)