Skip to content

Commit

Permalink
lintr
Browse files Browse the repository at this point in the history
  • Loading branch information
etiennebacher committed May 18, 2024
1 parent 01a858c commit 5c1a255
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions R/text_format.R
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ text_concatenate <- function(text, sep = ", ", last = " and ", enclose = NULL) {
if (length(text) == 1) {
s <- text
} else {
s <- paste0(text[1:(length(text) - 1)], collapse = sep)
s <- paste0(c(s, text[length(text)]), collapse = last)
s <- paste(text[1:(length(text) - 1)], collapse = sep)
s <- paste(c(s, text[length(text)]), collapse = last)
}
s
}
Expand Down Expand Up @@ -130,7 +130,7 @@ text_wrap <- function(text, width = NULL, ...) {
if (nchar(s) > width) {
leading_spaces <- nchar(s) - nchar(insight::trim_ws(s))
s <- strwrap(s, width = width)
s <- paste0(s, collapse = "\n")
s <- paste(s, collapse = "\n")
s <- paste0(strrep(" ", leading_spaces), s)
}
wrapped <- paste0(wrapped, s, "\n")
Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test-standardize_datagrid.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
test_that("standardize.datagrid", {
x <- insight::get_datagrid(iris, by = "Sepal.Length", range = "sd", length = 3)
out <- standardize(x)
expect_equal(as.numeric(out$Sepal.Length), c(-1, 0, 1))
expect_equal(as.numeric(out$Sepal.Width), c(0, 0, 0))
expect_identical(as.numeric(out$Sepal.Length), c(-1, 0, 1), tolerance = 1e-3)
expect_identical(as.numeric(out$Sepal.Width), c(0, 0, 0), tolerance = 1e-3)

x <- insight::get_datagrid(iris, by = "Sepal.Length = c(-1, 0)")
out <- unstandardize(x, select = "Sepal.Length")
expect_equal(out$Sepal.Length[1:2], c(mean(iris$Sepal.Length) - sd(iris$Sepal.Length), mean(iris$Sepal.Length)))
expect_identical(out$Sepal.Length[1:2], c(mean(iris$Sepal.Length) - sd(iris$Sepal.Length), mean(iris$Sepal.Length)), tolerance = 1e-3)

Check warning on line 10 in tests/testthat/test-standardize_datagrid.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=tests/testthat/test-standardize_datagrid.R,line=10,col=121,[line_length_linter] Lines should not be more than 120 characters. This line is 136 characters.
})

0 comments on commit 5c1a255

Please sign in to comment.