From 35a8481e642b68f650c38937e7731312bacf4e9a Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 4 Nov 2024 21:58:37 +0100 Subject: [PATCH] lintr --- tests/testthat/test-data_codebook.R | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/testthat/test-data_codebook.R b/tests/testthat/test-data_codebook.R index 108d5ad13..06e9bd2f9 100644 --- a/tests/testthat/test-data_codebook.R +++ b/tests/testthat/test-data_codebook.R @@ -19,7 +19,7 @@ test_that("data_codebook NaN and Inf", { set.seed(123) d <- data.frame( - x = c(sample(1:15, 100, TRUE), Inf, Inf) + x = c(sample.int(15, 100, TRUE), Inf, Inf) ) expect_snapshot(data_codebook(d)) expect_snapshot(data_codebook(d, range_at = 100)) @@ -63,7 +63,7 @@ test_that("data_codebook efc, value_label_width", { test_that("data_codebook truncated data", { set.seed(123) d <- data.frame( - a = sample(1:15, 100, TRUE), + a = sample.int(15, 100, TRUE), b = sample(letters[1:18], 100, TRUE), stringsAsFactors = FALSE ) @@ -74,7 +74,7 @@ test_that("data_codebook truncated data", { test_that("data_codebook mixed numeric lengths", { set.seed(123) d <- data.frame( - a = sample(1:4, 100, TRUE), + a = sample.int(4, 100, TRUE), b = sample(5:15, 100, TRUE), stringsAsFactors = FALSE ) @@ -84,7 +84,7 @@ test_that("data_codebook mixed numeric lengths", { test_that("data_codebook mixed range_at", { set.seed(123) d <- data.frame( - a = sample(1:4, 100, TRUE), + a = sample.int(4, 100, TRUE), b = sample(5:15, 100, TRUE), stringsAsFactors = FALSE ) @@ -95,7 +95,7 @@ test_that("data_codebook mixed range_at", { test_that("data_codebook logicals", { set.seed(123) d <- data.frame( - a = sample(1:15, 100, TRUE), + a = sample.int(15, 100, TRUE), b = sample(letters[1:3], 100, TRUE), c = sample(c(TRUE, FALSE), 100, TRUE), stringsAsFactors = FALSE @@ -107,14 +107,14 @@ test_that("data_codebook logicals", { test_that("data_codebook labelled data exceptions", { set.seed(123) - f1 <- sample(1:5, 100, TRUE) + f1 <- sample.int(5, 100, TRUE) f1[f1 == 4] <- NA attr(f1, "labels") <- setNames(1:5, c("One", "Two", "Three", "Four", "Five")) - f2 <- sample(1:5, 100, TRUE) + f2 <- sample.int(5, 100, TRUE) attr(f2, "labels") <- setNames(c(1:3, 5), c("One", "Two", "Three", "Five")) - f3 <- sample(1:5, 100, TRUE) + f3 <- sample.int(5, 100, TRUE) attr(f3, "labels") <- setNames(1:5, c("One", "Two", "Three", "Four", "Five")) d <- data.frame(f1, f2, f3) @@ -151,7 +151,7 @@ test_that("data_codebook works with numbers < 1", { test_that("data_codebook, big marks", { set.seed(123) f1 <- factor(sample(c("c", "b", "a"), 1e6, TRUE)) - f2 <- factor(sample(1:3, 1e6, TRUE)) + f2 <- factor(sample.int(3, 1e6, TRUE)) d <- data.frame(f1, f2) expect_snapshot(data_codebook(d)) })