Last updated on 2023-10-01 03:55:05 CEST.
Package | ERROR | NOTE | OK |
---|---|---|---|
admisc | 13 | ||
DDIwR | 4 | 9 | |
declared | 4 | 9 | |
QCA | 8 | 5 | |
venn | 13 |
Current CRAN status: OK: 13
Current CRAN status: ERROR: 4, OK: 9
Version: 0.15
Check: tests
Result: ERROR
Running ‘spelling.R’ [0s/1s]
Comparing ‘spelling.Rout’ to ‘spelling.Rout.save’ ... OK
Running ‘testthat.R’ [4s/5s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
> # This file is part of the standard setup for testthat.
> # It is recommended that you do not modify it.
> #
> # Where should you do additional test configuration?
> # Learn more about the roles of various files in:
> # * https://r-pkgs.org/tests.html
> # * https://testthat.r-lib.org/reference/test_package.html#special-files
>
> library(testthat)
> library(DDIwR)
Also attaching packages: admisc, declared, haven
>
> test_check("DDIwR")
[ FAIL 3 | WARN 0 | SKIP 0 | PASS 59 ]
══ Failed tests ════════════════════════════════════════════════════════════════
── Error ('test-convert.R:107:1'): (code run outside of `test_that()`) ─────────
Error in `var(if (is.vector(x) || is.factor(x)) x else as.double(x), na.rm = na.rm)`: is.atomic(y) is not TRUE
Backtrace:
▆
1. └─DDIwR::convert(dfm, to = file.path(tmp, "dfm.xml")) at test-convert.R:107:0
2. └─DDIwR::exportDDI(codebook = codeBook, file = to, ... = ...)
3. ├─base::cat(...)
4. ├─base::paste(...)
5. ├─base::format(sd(vals, na.rm = TRUE), scientific = FALSE)
6. └─declared (local) sd(vals, na.rm = TRUE)
7. └─declared (local) var(if (is.vector(x) || is.factor(x)) x else as.double(x), na.rm = na.rm)
8. └─base::stopifnot(is.atomic(y))
── Error ('test-exportDDI.R:10:1'): (code run outside of `test_that()`) ────────
Error in `var(if (is.vector(x) || is.factor(x)) x else as.double(x), na.rm = na.rm)`: is.atomic(y) is not TRUE
Backtrace:
▆
1. └─DDIwR::exportDDI(codebook, file = file.path(tmp, "dfm.xml")) at test-exportDDI.R:10:0
2. ├─base::cat(...)
3. ├─base::paste(...)
4. ├─base::format(sd(vals, na.rm = TRUE), scientific = FALSE)
5. └─declared (local) sd(vals, na.rm = TRUE)
6. └─declared (local) var(if (is.vector(x) || is.factor(x)) x else as.double(x), na.rm = na.rm)
7. └─base::stopifnot(is.atomic(y))
── Error ('test-getMetadata.R:32:1'): (code run outside of `test_that()`) ──────
Error in `var(if (is.vector(x) || is.factor(x)) x else as.double(x), na.rm = na.rm)`: is.atomic(y) is not TRUE
Backtrace:
▆
1. └─DDIwR::convert(x, to = file.path(tmp, "x.xml")) at test-getMetadata.R:32:0
2. └─DDIwR::exportDDI(codebook = codeBook, file = to, ... = ...)
3. ├─base::cat(...)
4. ├─base::paste(...)
5. ├─base::format(sd(vals, na.rm = TRUE), scientific = FALSE)
6. └─declared (local) sd(vals, na.rm = TRUE)
7. └─declared (local) var(if (is.vector(x) || is.factor(x)) x else as.double(x), na.rm = na.rm)
8. └─base::stopifnot(is.atomic(y))
[ FAIL 3 | WARN 0 | SKIP 0 | PASS 59 ]
Error: Test failures
Execution halted
Flavor: r-devel-linux-x86_64-debian-gcc
Version: 0.15
Check: tests
Result: ERROR
Running ‘spelling.R’
Comparing ‘spelling.Rout’ to ‘spelling.Rout.save’ ... OK
Running ‘testthat.R’ [7s/28s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
> # This file is part of the standard setup for testthat.
> # It is recommended that you do not modify it.
> #
> # Where should you do additional test configuration?
> # Learn more about the roles of various files in:
> # * https://r-pkgs.org/tests.html
> # * https://testthat.r-lib.org/reference/test_package.html#special-files
>
> library(testthat)
> library(DDIwR)
Also attaching packages: admisc, declared, haven
>
> test_check("DDIwR")
[ FAIL 3 | WARN 0 | SKIP 0 | PASS 59 ]
══ Failed tests ════════════════════════════════════════════════════════════════
── Error ('test-convert.R:107:1'): (code run outside of `test_that()`) ─────────
Error in `var(if (is.vector(x) || is.factor(x)) x else as.double(x), na.rm = na.rm)`: is.atomic(y) is not TRUE
Backtrace:
▆
1. └─DDIwR::convert(dfm, to = file.path(tmp, "dfm.xml")) at test-convert.R:107:0
2. └─DDIwR::exportDDI(codebook = codeBook, file = to, ... = ...)
3. ├─base::cat(...)
4. ├─base::paste(...)
5. ├─base::format(sd(vals, na.rm = TRUE), scientific = FALSE)
6. └─declared (local) sd(vals, na.rm = TRUE)
7. └─declared (local) var(if (is.vector(x) || is.factor(x)) x else as.double(x), na.rm = na.rm)
8. └─base::stopifnot(is.atomic(y))
── Error ('test-exportDDI.R:10:1'): (code run outside of `test_that()`) ────────
Error in `var(if (is.vector(x) || is.factor(x)) x else as.double(x), na.rm = na.rm)`: is.atomic(y) is not TRUE
Backtrace:
▆
1. └─DDIwR::exportDDI(codebook, file = file.path(tmp, "dfm.xml")) at test-exportDDI.R:10:0
2. ├─base::cat(...)
3. ├─base::paste(...)
4. ├─base::format(sd(vals, na.rm = TRUE), scientific = FALSE)
5. └─declared (local) sd(vals, na.rm = TRUE)
6. └─declared (local) var(if (is.vector(x) || is.factor(x)) x else as.double(x), na.rm = na.rm)
7. └─base::stopifnot(is.atomic(y))
── Error ('test-getMetadata.R:32:1'): (code run outside of `test_that()`) ──────
Error in `var(if (is.vector(x) || is.factor(x)) x else as.double(x), na.rm = na.rm)`: is.atomic(y) is not TRUE
Backtrace:
▆
1. └─DDIwR::convert(x, to = file.path(tmp, "x.xml")) at test-getMetadata.R:32:0
2. └─DDIwR::exportDDI(codebook = codeBook, file = to, ... = ...)
3. ├─base::cat(...)
4. ├─base::paste(...)
5. ├─base::format(sd(vals, na.rm = TRUE), scientific = FALSE)
6. └─declared (local) sd(vals, na.rm = TRUE)
7. └─declared (local) var(if (is.vector(x) || is.factor(x)) x else as.double(x), na.rm = na.rm)
8. └─base::stopifnot(is.atomic(y))
[ FAIL 3 | WARN 0 | SKIP 0 | PASS 59 ]
Error: Test failures
Execution halted
Flavor: r-devel-linux-x86_64-fedora-clang
Version: 0.15
Check: tests
Result: ERROR
Running ‘spelling.R’
Comparing ‘spelling.Rout’ to ‘spelling.Rout.save’ ... OK
Running ‘testthat.R’ [7s/15s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
> # This file is part of the standard setup for testthat.
> # It is recommended that you do not modify it.
> #
> # Where should you do additional test configuration?
> # Learn more about the roles of various files in:
> # * https://r-pkgs.org/tests.html
> # * https://testthat.r-lib.org/reference/test_package.html#special-files
>
> library(testthat)
> library(DDIwR)
Also attaching packages: admisc, declared, haven
>
> test_check("DDIwR")
[ FAIL 3 | WARN 0 | SKIP 0 | PASS 59 ]
══ Failed tests ════════════════════════════════════════════════════════════════
── Error ('test-convert.R:107:1'): (code run outside of `test_that()`) ─────────
Error in `var(if (is.vector(x) || is.factor(x)) x else as.double(x), na.rm = na.rm)`: is.atomic(y) is not TRUE
Backtrace:
▆
1. └─DDIwR::convert(dfm, to = file.path(tmp, "dfm.xml")) at test-convert.R:107:0
2. └─DDIwR::exportDDI(codebook = codeBook, file = to, ... = ...)
3. ├─base::cat(...)
4. ├─base::paste(...)
5. ├─base::format(sd(vals, na.rm = TRUE), scientific = FALSE)
6. └─declared (local) sd(vals, na.rm = TRUE)
7. └─declared (local) var(if (is.vector(x) || is.factor(x)) x else as.double(x), na.rm = na.rm)
8. └─base::stopifnot(is.atomic(y))
── Error ('test-exportDDI.R:10:1'): (code run outside of `test_that()`) ────────
Error in `var(if (is.vector(x) || is.factor(x)) x else as.double(x), na.rm = na.rm)`: is.atomic(y) is not TRUE
Backtrace:
▆
1. └─DDIwR::exportDDI(codebook, file = file.path(tmp, "dfm.xml")) at test-exportDDI.R:10:0
2. ├─base::cat(...)
3. ├─base::paste(...)
4. ├─base::format(sd(vals, na.rm = TRUE), scientific = FALSE)
5. └─declared (local) sd(vals, na.rm = TRUE)
6. └─declared (local) var(if (is.vector(x) || is.factor(x)) x else as.double(x), na.rm = na.rm)
7. └─base::stopifnot(is.atomic(y))
── Error ('test-getMetadata.R:32:1'): (code run outside of `test_that()`) ──────
Error in `var(if (is.vector(x) || is.factor(x)) x else as.double(x), na.rm = na.rm)`: is.atomic(y) is not TRUE
Backtrace:
▆
1. └─DDIwR::convert(x, to = file.path(tmp, "x.xml")) at test-getMetadata.R:32:0
2. └─DDIwR::exportDDI(codebook = codeBook, file = to, ... = ...)
3. ├─base::cat(...)
4. ├─base::paste(...)
5. ├─base::format(sd(vals, na.rm = TRUE), scientific = FALSE)
6. └─declared (local) sd(vals, na.rm = TRUE)
7. └─declared (local) var(if (is.vector(x) || is.factor(x)) x else as.double(x), na.rm = na.rm)
8. └─base::stopifnot(is.atomic(y))
[ FAIL 3 | WARN 0 | SKIP 0 | PASS 59 ]
Error: Test failures
Execution halted
Flavor: r-devel-linux-x86_64-fedora-gcc
Version: 0.15
Check: tests
Result: ERROR
Running 'spelling.R' [0s]
Comparing 'spelling.Rout' to 'spelling.Rout.save' ... OK
Running 'testthat.R' [4s]
Running the tests in 'tests/testthat.R' failed.
Complete output:
> # This file is part of the standard setup for testthat.
> # It is recommended that you do not modify it.
> #
> # Where should you do additional test configuration?
> # Learn more about the roles of various files in:
> # * https://r-pkgs.org/tests.html
> # * https://testthat.r-lib.org/reference/test_package.html#special-files
>
> library(testthat)
> library(DDIwR)
Also attaching packages: admisc, declared, haven
>
> test_check("DDIwR")
[ FAIL 3 | WARN 0 | SKIP 0 | PASS 59 ]
══ Failed tests ════════════════════════════════════════════════════════════════
── Error ('test-convert.R:107:1'): (code run outside of `test_that()`) ─────────
Error in `var(if (is.vector(x) || is.factor(x)) x else as.double(x), na.rm = na.rm)`: is.atomic(y) is not TRUE
Backtrace:
▆
1. └─DDIwR::convert(dfm, to = file.path(tmp, "dfm.xml")) at test-convert.R:107:0
2. └─DDIwR::exportDDI(codebook = codeBook, file = to, ... = ...)
3. ├─base::cat(...)
4. ├─base::paste(...)
5. ├─base::format(sd(vals, na.rm = TRUE), scientific = FALSE)
6. └─declared (local) sd(vals, na.rm = TRUE)
7. └─declared (local) var(if (is.vector(x) || is.factor(x)) x else as.double(x), na.rm = na.rm)
8. └─base::stopifnot(is.atomic(y))
── Error ('test-exportDDI.R:10:1'): (code run outside of `test_that()`) ────────
Error in `var(if (is.vector(x) || is.factor(x)) x else as.double(x), na.rm = na.rm)`: is.atomic(y) is not TRUE
Backtrace:
▆
1. └─DDIwR::exportDDI(codebook, file = file.path(tmp, "dfm.xml")) at test-exportDDI.R:10:0
2. ├─base::cat(...)
3. ├─base::paste(...)
4. ├─base::format(sd(vals, na.rm = TRUE), scientific = FALSE)
5. └─declared (local) sd(vals, na.rm = TRUE)
6. └─declared (local) var(if (is.vector(x) || is.factor(x)) x else as.double(x), na.rm = na.rm)
7. └─base::stopifnot(is.atomic(y))
── Error ('test-getMetadata.R:32:1'): (code run outside of `test_that()`) ──────
Error in `var(if (is.vector(x) || is.factor(x)) x else as.double(x), na.rm = na.rm)`: is.atomic(y) is not TRUE
Backtrace:
▆
1. └─DDIwR::convert(x, to = file.path(tmp, "x.xml")) at test-getMetadata.R:32:0
2. └─DDIwR::exportDDI(codebook = codeBook, file = to, ... = ...)
3. ├─base::cat(...)
4. ├─base::paste(...)
5. ├─base::format(sd(vals, na.rm = TRUE), scientific = FALSE)
6. └─declared (local) sd(vals, na.rm = TRUE)
7. └─declared (local) var(if (is.vector(x) || is.factor(x)) x else as.double(x), na.rm = na.rm)
8. └─base::stopifnot(is.atomic(y))
[ FAIL 3 | WARN 0 | SKIP 0 | PASS 59 ]
Error: Test failures
Execution halted
Flavor: r-devel-windows-x86_64
Current CRAN status: ERROR: 4, OK: 9
Version: 0.22
Check: examples
Result: ERROR
Running examples in ‘declared-Ex.R’ failed
The error most likely occurred in:
> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: w_IQR
> ### Title: Compute weighted summaries for declared objects
> ### Aliases: w_IQR w_fivenum w_mean w_median w_mode w_quantile w_sd
> ### w_standardize w_summary weighted w_table w_var
>
> ### ** Examples
>
> set.seed(215)
>
> # a pure categorical variable
> x <- factor(sample(letters[1:5], 215, replace = TRUE))
> w_table(x)
fre rel per cpd
----------------------
a 37 0.172 17.2 17.2
b 45 0.209 20.9 38.1
c 43 0.200 20.0 58.1
d 44 0.205 20.5 78.6
e 46 0.214 21.4 100.0
----------------------
215 1.000 100.0
>
>
> # simulate number of children
> x <- sample(0:4, 215, replace = TRUE)
> w_table(x)
fre rel per cpd
----------------------
0 36 0.167 16.7 16.7
1 41 0.191 19.1 35.8
2 49 0.228 22.8 58.6
3 45 0.209 20.9 79.5
4 44 0.205 20.5 100.0
----------------------
215 1.000 100.0
>
> # simulate a Likert type response scale from 1 to 7
> values <- sample(c(1:7, -91), 215, replace = TRUE)
> x <- declared(values, labels = c("Good" = 1, "Bad" = 7))
> w_table(x)
fre rel per cpd
----------------------
-91 16 0.074 7.4 7.4
Good 25 0.116 11.6 19.1
2 25 0.116 11.6 30.7
3 32 0.149 14.9 45.6
4 37 0.172 17.2 62.8
5 24 0.112 11.2 74.0
6 21 0.098 9.8 83.7
Bad 35 0.163 16.3 100.0
----------------------
215 1.000 100.0
>
>
> # Defining missing values
> missing_values(x) <- -91
> w_table(x)
fre rel per vld cpd
----------------------------
Good 25 0.116 11.6 12.6 12.6
2 25 0.116 11.6 12.6 25.1
3 32 0.149 14.9 16.1 41.2
4 37 0.172 17.2 18.6 59.8
5 24 0.112 11.2 12.1 71.9
6 21 0.098 9.8 10.6 82.4
Bad 35 0.163 16.3 17.6 100.0
----
-91 16 0.074 7.4
----------------------------
215 1.000 100.0
>
>
> # Defined missing values with labels
> values <- sample(c(1:7, -91, NA), 215, replace = TRUE)
> x <- declared(
+ values,
+ labels = c("Good" = 1, "Bad" = 7, "Don't know" = -91),
+ na_values = -91
+ )
>
> w_table(x)
fre rel per vld cpd
----------------------------
Good 20 0.093 9.3 12.0 12.0
2 33 0.153 15.3 19.9 31.9
3 27 0.126 12.6 16.3 48.2
4 27 0.126 12.6 16.3 64.5
5 22 0.102 10.2 13.3 77.7
6 22 0.102 10.2 13.3 91.0
Bad 15 0.070 7.0 9.0 100.0
-----
Don't know 24 0.112 11.2
NA 25 0.116 11.6
----------------------------
215 1.000 100.0
>
> # Including the values in the table of frequencies
> w_table(x, values = TRUE)
fre rel per vld cpd
----------------------------
Good 1 20 0.093 9.3 12.0 12.0
2 2 33 0.153 15.3 19.9 31.9
3 3 27 0.126 12.6 16.3 48.2
4 4 27 0.126 12.6 16.3 64.5
5 5 22 0.102 10.2 13.3 77.7
6 6 22 0.102 10.2 13.3 91.0
Bad 7 15 0.070 7.0 9.0 100.0
-----
Don't know -91 24 0.112 11.2
NA 25 0.116 11.6
----------------------------
215 1.000 100.0
>
>
> # An example involving multiple variables
> DF <- data.frame(
+ Area = declared(
+ sample(1:2, 215, replace = TRUE, prob = c(0.45, 0.55)),
+ labels = c(Rural = 1, Urban = 2)
+ ),
+ Gender = declared(
+ sample(1:2, 215, replace = TRUE, prob = c(0.55, 0.45)),
+ labels = c(Males = 1, Females = 2)
+ ),
+ Age = sample(18:90, 215, replace = TRUE),
+ Children = sample(0:5, 215, replace = TRUE)
+ )
>
> w_table(DF$Gender)
fre rel per cpd
----------------------
Males 119 0.553 55.3 55.3
Females 96 0.447 44.7 100.0
----------------------
215 1.000 100.0
>
> w_sd(DF$Age)
Error in var(x, na.rm = na.rm) : is.atomic(y) is not TRUE
Calls: w_sd -> w_var -> var -> stopifnot
Execution halted
Flavor: r-devel-linux-x86_64-debian-gcc
Version: 0.22
Check: tests
Result: ERROR
Running ‘spelling.R’ [0s/0s]
Running ‘testthat.R’ [11s/18s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
> # This file is part of the standard setup for testthat.
> # It is recommended that you do not modify it.
> #
> # Where should you do additional test configuration?
> # Learn more about the roles of various files in:
> # * https://r-pkgs.org/tests.html
> # * https://testthat.r-lib.org/reference/test_package.html#special-files
>
> library(testthat)
> library(declared)
>
> test_check("declared")
[ FAIL 4 | WARN 0 | SKIP 31 | PASS 437 ]
══ Skipped tests (31) ══════════════════════════════════════════════════════════
• On CRAN (31): 'test-as.character.R:43:3', 'test-as.declared.R:94:3',
'test-as.factor.R:34:3', 'test-class_methods.R:308:3',
'test-declared.R:140:3', 'test-drop_undeclare.R:70:3', 'test-haven.R:131:3',
'test-internals.R:201:3', 'test-is.empty.R:21:3', 'test-labelled.R:146:3',
'test-labels.R:130:3', 'test-measurement.R:38:3',
'test-missing_range.R:46:3', 'test-missing_values.R:43:3',
'test-onLoad.R:167:3', 'test-pillar.R:94:3', 'test-print.R:118:3',
'test-print.R:150:3', 'test-vctrs.R:16:3', 'test-vroom.R:12:3',
'test-w_IQR.R:22:3', 'test-w_fivenum.R:39:3', 'test-w_mean.R:82:3',
'test-w_median.R:68:3', 'test-w_mode.R:33:3', 'test-w_quantile.R:91:3',
'test-w_sd.R:52:3', 'test-w_standardize.R:63:3', 'test-w_summary.R:24:3',
'test-w_table.R:120:3', 'test-w_var.R:40:3'
══ Failed tests ════════════════════════════════════════════════════════════════
── Error ('test-onLoad.R:99:3'): onLoad functions work ─────────────────────────
Error in `var(if (is.vector(x) || is.factor(x)) x else as.double(x), na.rm = na.rm)`: is.atomic(y) is not TRUE
Backtrace:
▆
1. ├─testthat::expect_length(sd(x), 1) at test-onLoad.R:99:2
2. │ └─testthat::quasi_label(enquo(object), arg = "object")
3. │ └─rlang::eval_bare(expr, quo_get_env(quo))
4. └─declared (local) sd(x)
5. └─declared (local) var(if (is.vector(x) || is.factor(x)) x else as.double(x), na.rm = na.rm)
6. └─base::stopifnot(is.atomic(y))
── Error ('test-w_mode.R:20:3'): w_mode() works ────────────────────────────────
Error: 'wt' should be an atomic vector with finite values.
Backtrace:
▆
1. ├─testthat::expect_message(w_mode(x[-1]), "Multiple modes detected") at test-w_mode.R:20:2
2. │ └─testthat:::expect_condition_matching(...)
3. │ └─testthat:::quasi_capture(...)
4. │ ├─testthat (local) .capture(...)
5. │ │ └─base::withCallingHandlers(...)
6. │ └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
7. └─declared::w_mode(x[-1])
8. └─declared:::stopError_("'wt' should be an atomic vector with finite values.")
── Error ('test-w_sd.R:9:3'): w_sd() works ─────────────────────────────────────
Error in `var(x, na.rm = na.rm)`: is.atomic(y) is not TRUE
Backtrace:
▆
1. ├─testthat::expect_equal(w_sd(x), sd(c(1:5, NA), na.rm = TRUE)) at test-w_sd.R:9:2
2. │ └─testthat::quasi_label(enquo(object), label, arg = "object")
3. │ └─rlang::eval_bare(expr, quo_get_env(quo))
4. └─declared::w_sd(x)
5. └─declared::w_var(x = x, wt = wt, method = method, na.rm = na.rm)
6. └─declared (local) var(x, na.rm = na.rm)
7. └─base::stopifnot(is.atomic(y))
── Error ('test-w_var.R:15:3'): w_var() works ──────────────────────────────────
Error in `var(x, na.rm = na.rm)`: is.atomic(y) is not TRUE
Backtrace:
▆
1. ├─testthat::expect_equal(w_var(x), var(c(1:5, NA), na.rm = TRUE)) at test-w_var.R:15:2
2. │ └─testthat::quasi_label(enquo(object), label, arg = "object")
3. │ └─rlang::eval_bare(expr, quo_get_env(quo))
4. └─declared::w_var(x)
5. └─declared (local) var(x, na.rm = na.rm)
6. └─base::stopifnot(is.atomic(y))
[ FAIL 4 | WARN 0 | SKIP 31 | PASS 437 ]
Error: Test failures
Execution halted
Flavor: r-devel-linux-x86_64-debian-gcc
Version: 0.22
Check: examples
Result: ERROR
Running examples in ‘declared-Ex.R’ failed
The error most likely occurred in:
> ### Name: w_IQR
> ### Title: Compute weighted summaries for declared objects
> ### Aliases: w_IQR w_fivenum w_mean w_median w_mode w_quantile w_sd
> ### w_standardize w_summary weighted w_table w_var
>
> ### ** Examples
>
> set.seed(215)
>
> # a pure categorical variable
> x <- factor(sample(letters[1:5], 215, replace = TRUE))
> w_table(x)
fre rel per cpd
----------------------
a 37 0.172 17.2 17.2
b 45 0.209 20.9 38.1
c 43 0.200 20.0 58.1
d 44 0.205 20.5 78.6
e 46 0.214 21.4 100.0
----------------------
215 1.000 100.0
>
>
> # simulate number of children
> x <- sample(0:4, 215, replace = TRUE)
> w_table(x)
fre rel per cpd
----------------------
0 36 0.167 16.7 16.7
1 41 0.191 19.1 35.8
2 49 0.228 22.8 58.6
3 45 0.209 20.9 79.5
4 44 0.205 20.5 100.0
----------------------
215 1.000 100.0
>
> # simulate a Likert type response scale from 1 to 7
> values <- sample(c(1:7, -91), 215, replace = TRUE)
> x <- declared(values, labels = c("Good" = 1, "Bad" = 7))
> w_table(x)
fre rel per cpd
----------------------
-91 16 0.074 7.4 7.4
Good 25 0.116 11.6 19.1
2 25 0.116 11.6 30.7
3 32 0.149 14.9 45.6
4 37 0.172 17.2 62.8
5 24 0.112 11.2 74.0
6 21 0.098 9.8 83.7
Bad 35 0.163 16.3 100.0
----------------------
215 1.000 100.0
>
>
> # Defining missing values
> missing_values(x) <- -91
> w_table(x)
fre rel per vld cpd
----------------------------
Good 25 0.116 11.6 12.6 12.6
2 25 0.116 11.6 12.6 25.1
3 32 0.149 14.9 16.1 41.2
4 37 0.172 17.2 18.6 59.8
5 24 0.112 11.2 12.1 71.9
6 21 0.098 9.8 10.6 82.4
Bad 35 0.163 16.3 17.6 100.0
----
-91 16 0.074 7.4
----------------------------
215 1.000 100.0
>
>
> # Defined missing values with labels
> values <- sample(c(1:7, -91, NA), 215, replace = TRUE)
> x <- declared(
+ values,
+ labels = c("Good" = 1, "Bad" = 7, "Don't know" = -91),
+ na_values = -91
+ )
>
> w_table(x)
fre rel per vld cpd
----------------------------
Good 20 0.093 9.3 12.0 12.0
2 33 0.153 15.3 19.9 31.9
3 27 0.126 12.6 16.3 48.2
4 27 0.126 12.6 16.3 64.5
5 22 0.102 10.2 13.3 77.7
6 22 0.102 10.2 13.3 91.0
Bad 15 0.070 7.0 9.0 100.0
-----
Don't know 24 0.112 11.2
NA 25 0.116 11.6
----------------------------
215 1.000 100.0
>
> # Including the values in the table of frequencies
> w_table(x, values = TRUE)
fre rel per vld cpd
----------------------------
Good 1 20 0.093 9.3 12.0 12.0
2 2 33 0.153 15.3 19.9 31.9
3 3 27 0.126 12.6 16.3 48.2
4 4 27 0.126 12.6 16.3 64.5
5 5 22 0.102 10.2 13.3 77.7
6 6 22 0.102 10.2 13.3 91.0
Bad 7 15 0.070 7.0 9.0 100.0
-----
Don't know -91 24 0.112 11.2
NA 25 0.116 11.6
----------------------------
215 1.000 100.0
>
>
> # An example involving multiple variables
> DF <- data.frame(
+ Area = declared(
+ sample(1:2, 215, replace = TRUE, prob = c(0.45, 0.55)),
+ labels = c(Rural = 1, Urban = 2)
+ ),
+ Gender = declared(
+ sample(1:2, 215, replace = TRUE, prob = c(0.55, 0.45)),
+ labels = c(Males = 1, Females = 2)
+ ),
+ Age = sample(18:90, 215, replace = TRUE),
+ Children = sample(0:5, 215, replace = TRUE)
+ )
>
> w_table(DF$Gender)
fre rel per cpd
----------------------
Males 119 0.553 55.3 55.3
Females 96 0.447 44.7 100.0
----------------------
215 1.000 100.0
>
> w_sd(DF$Age)
Error in var(x, na.rm = na.rm) : is.atomic(y) is not TRUE
Calls: w_sd -> w_var -> var -> stopifnot
Execution halted
Flavors: r-devel-linux-x86_64-fedora-clang, r-devel-linux-x86_64-fedora-gcc, r-devel-windows-x86_64
Version: 0.22
Check: tests
Result: ERROR
Running ‘spelling.R’
Running ‘testthat.R’ [11s/11s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
> # This file is part of the standard setup for testthat.
> # It is recommended that you do not modify it.
> #
> # Where should you do additional test configuration?
> # Learn more about the roles of various files in:
> # * https://r-pkgs.org/tests.html
> # * https://testthat.r-lib.org/reference/test_package.html#special-files
>
> library(testthat)
> library(declared)
>
> test_check("declared")
[ FAIL 4 | WARN 0 | SKIP 31 | PASS 437 ]
══ Skipped tests (31) ══════════════════════════════════════════════════════════
• On CRAN (31): 'test-as.character.R:43:3', 'test-as.declared.R:94:3',
'test-as.factor.R:34:3', 'test-class_methods.R:308:3',
'test-declared.R:140:3', 'test-drop_undeclare.R:70:3', 'test-haven.R:131:3',
'test-internals.R:201:3', 'test-is.empty.R:21:3', 'test-labelled.R:146:3',
'test-labels.R:130:3', 'test-measurement.R:38:3',
'test-missing_range.R:46:3', 'test-missing_values.R:43:3',
'test-onLoad.R:167:3', 'test-pillar.R:94:3', 'test-print.R:118:3',
'test-print.R:150:3', 'test-vctrs.R:16:3', 'test-vroom.R:12:3',
'test-w_IQR.R:22:3', 'test-w_fivenum.R:39:3', 'test-w_mean.R:82:3',
'test-w_median.R:68:3', 'test-w_mode.R:33:3', 'test-w_quantile.R:91:3',
'test-w_sd.R:52:3', 'test-w_standardize.R:63:3', 'test-w_summary.R:24:3',
'test-w_table.R:120:3', 'test-w_var.R:40:3'
══ Failed tests ════════════════════════════════════════════════════════════════
── Error ('test-onLoad.R:99:3'): onLoad functions work ─────────────────────────
Error in `var(if (is.vector(x) || is.factor(x)) x else as.double(x), na.rm = na.rm)`: is.atomic(y) is not TRUE
Backtrace:
▆
1. ├─testthat::expect_length(sd(x), 1) at test-onLoad.R:99:2
2. │ └─testthat::quasi_label(enquo(object), arg = "object")
3. │ └─rlang::eval_bare(expr, quo_get_env(quo))
4. └─declared (local) sd(x)
5. └─declared (local) var(if (is.vector(x) || is.factor(x)) x else as.double(x), na.rm = na.rm)
6. └─base::stopifnot(is.atomic(y))
── Error ('test-w_mode.R:20:3'): w_mode() works ────────────────────────────────
Error: 'wt' should be an atomic vector with finite values.
Backtrace:
▆
1. ├─testthat::expect_message(w_mode(x[-1]), "Multiple modes detected") at test-w_mode.R:20:2
2. │ └─testthat:::expect_condition_matching(...)
3. │ └─testthat:::quasi_capture(...)
4. │ ├─testthat (local) .capture(...)
5. │ │ └─base::withCallingHandlers(...)
6. │ └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
7. └─declared::w_mode(x[-1])
8. └─declared:::stopError_("'wt' should be an atomic vector with finite values.")
── Error ('test-w_sd.R:9:3'): w_sd() works ─────────────────────────────────────
Error in `var(x, na.rm = na.rm)`: is.atomic(y) is not TRUE
Backtrace:
▆
1. ├─testthat::expect_equal(w_sd(x), sd(c(1:5, NA), na.rm = TRUE)) at test-w_sd.R:9:2
2. │ └─testthat::quasi_label(enquo(object), label, arg = "object")
3. │ └─rlang::eval_bare(expr, quo_get_env(quo))
4. └─declared::w_sd(x)
5. └─declared::w_var(x = x, wt = wt, method = method, na.rm = na.rm)
6. └─declared (local) var(x, na.rm = na.rm)
7. └─base::stopifnot(is.atomic(y))
── Error ('test-w_var.R:15:3'): w_var() works ──────────────────────────────────
Error in `var(x, na.rm = na.rm)`: is.atomic(y) is not TRUE
Backtrace:
▆
1. ├─testthat::expect_equal(w_var(x), var(c(1:5, NA), na.rm = TRUE)) at test-w_var.R:15:2
2. │ └─testthat::quasi_label(enquo(object), label, arg = "object")
3. │ └─rlang::eval_bare(expr, quo_get_env(quo))
4. └─declared::w_var(x)
5. └─declared (local) var(x, na.rm = na.rm)
6. └─base::stopifnot(is.atomic(y))
[ FAIL 4 | WARN 0 | SKIP 31 | PASS 437 ]
Error: Test failures
Execution halted
Flavor: r-devel-linux-x86_64-fedora-clang
Version: 0.22
Check: tests
Result: ERROR
Running ‘spelling.R’
Running ‘testthat.R’ [10s/10s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
> # This file is part of the standard setup for testthat.
> # It is recommended that you do not modify it.
> #
> # Where should you do additional test configuration?
> # Learn more about the roles of various files in:
> # * https://r-pkgs.org/tests.html
> # * https://testthat.r-lib.org/reference/test_package.html#special-files
>
> library(testthat)
> library(declared)
>
> test_check("declared")
[ FAIL 4 | WARN 0 | SKIP 31 | PASS 437 ]
══ Skipped tests (31) ══════════════════════════════════════════════════════════
• On CRAN (31): 'test-as.character.R:43:3', 'test-as.declared.R:94:3',
'test-as.factor.R:34:3', 'test-class_methods.R:308:3',
'test-declared.R:140:3', 'test-drop_undeclare.R:70:3', 'test-haven.R:131:3',
'test-internals.R:201:3', 'test-is.empty.R:21:3', 'test-labelled.R:146:3',
'test-labels.R:130:3', 'test-measurement.R:38:3',
'test-missing_range.R:46:3', 'test-missing_values.R:43:3',
'test-onLoad.R:167:3', 'test-pillar.R:94:3', 'test-print.R:118:3',
'test-print.R:150:3', 'test-vctrs.R:16:3', 'test-vroom.R:12:3',
'test-w_IQR.R:22:3', 'test-w_fivenum.R:39:3', 'test-w_mean.R:82:3',
'test-w_median.R:68:3', 'test-w_mode.R:33:3', 'test-w_quantile.R:91:3',
'test-w_sd.R:52:3', 'test-w_standardize.R:63:3', 'test-w_summary.R:24:3',
'test-w_table.R:120:3', 'test-w_var.R:40:3'
══ Failed tests ════════════════════════════════════════════════════════════════
── Error ('test-onLoad.R:99:3'): onLoad functions work ─────────────────────────
Error in `var(if (is.vector(x) || is.factor(x)) x else as.double(x), na.rm = na.rm)`: is.atomic(y) is not TRUE
Backtrace:
▆
1. ├─testthat::expect_length(sd(x), 1) at test-onLoad.R:99:2
2. │ └─testthat::quasi_label(enquo(object), arg = "object")
3. │ └─rlang::eval_bare(expr, quo_get_env(quo))
4. └─declared (local) sd(x)
5. └─declared (local) var(if (is.vector(x) || is.factor(x)) x else as.double(x), na.rm = na.rm)
6. └─base::stopifnot(is.atomic(y))
── Error ('test-w_mode.R:20:3'): w_mode() works ────────────────────────────────
Error: 'wt' should be an atomic vector with finite values.
Backtrace:
▆
1. ├─testthat::expect_message(w_mode(x[-1]), "Multiple modes detected") at test-w_mode.R:20:2
2. │ └─testthat:::expect_condition_matching(...)
3. │ └─testthat:::quasi_capture(...)
4. │ ├─testthat (local) .capture(...)
5. │ │ └─base::withCallingHandlers(...)
6. │ └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
7. └─declared::w_mode(x[-1])
8. └─declared:::stopError_("'wt' should be an atomic vector with finite values.")
── Error ('test-w_sd.R:9:3'): w_sd() works ─────────────────────────────────────
Error in `var(x, na.rm = na.rm)`: is.atomic(y) is not TRUE
Backtrace:
▆
1. ├─testthat::expect_equal(w_sd(x), sd(c(1:5, NA), na.rm = TRUE)) at test-w_sd.R:9:2
2. │ └─testthat::quasi_label(enquo(object), label, arg = "object")
3. │ └─rlang::eval_bare(expr, quo_get_env(quo))
4. └─declared::w_sd(x)
5. └─declared::w_var(x = x, wt = wt, method = method, na.rm = na.rm)
6. └─declared (local) var(x, na.rm = na.rm)
7. └─base::stopifnot(is.atomic(y))
── Error ('test-w_var.R:15:3'): w_var() works ──────────────────────────────────
Error in `var(x, na.rm = na.rm)`: is.atomic(y) is not TRUE
Backtrace:
▆
1. ├─testthat::expect_equal(w_var(x), var(c(1:5, NA), na.rm = TRUE)) at test-w_var.R:15:2
2. │ └─testthat::quasi_label(enquo(object), label, arg = "object")
3. │ └─rlang::eval_bare(expr, quo_get_env(quo))
4. └─declared::w_var(x)
5. └─declared (local) var(x, na.rm = na.rm)
6. └─base::stopifnot(is.atomic(y))
[ FAIL 4 | WARN 0 | SKIP 31 | PASS 437 ]
Error: Test failures
Execution halted
Flavor: r-devel-linux-x86_64-fedora-gcc
Version: 0.22
Check: tests
Result: ERROR
Running 'spelling.R' [0s]
Running 'testthat.R' [11s]
Running the tests in 'tests/testthat.R' failed.
Complete output:
> # This file is part of the standard setup for testthat.
> # It is recommended that you do not modify it.
> #
> # Where should you do additional test configuration?
> # Learn more about the roles of various files in:
> # * https://r-pkgs.org/tests.html
> # * https://testthat.r-lib.org/reference/test_package.html#special-files
>
> library(testthat)
> library(declared)
>
> test_check("declared")
[ FAIL 4 | WARN 0 | SKIP 31 | PASS 437 ]
══ Skipped tests (31) ══════════════════════════════════════════════════════════
• On CRAN (31): 'test-as.character.R:43:3', 'test-as.declared.R:94:3',
'test-as.factor.R:34:3', 'test-class_methods.R:308:3',
'test-declared.R:140:3', 'test-drop_undeclare.R:70:3', 'test-haven.R:131:3',
'test-internals.R:201:3', 'test-is.empty.R:21:3', 'test-labelled.R:146:3',
'test-labels.R:130:3', 'test-measurement.R:38:3',
'test-missing_range.R:46:3', 'test-missing_values.R:43:3',
'test-onLoad.R:167:3', 'test-pillar.R:94:3', 'test-print.R:118:3',
'test-print.R:150:3', 'test-vctrs.R:16:3', 'test-vroom.R:12:3',
'test-w_IQR.R:22:3', 'test-w_fivenum.R:39:3', 'test-w_mean.R:82:3',
'test-w_median.R:68:3', 'test-w_mode.R:33:3', 'test-w_quantile.R:91:3',
'test-w_sd.R:52:3', 'test-w_standardize.R:63:3', 'test-w_summary.R:24:3',
'test-w_table.R:120:3', 'test-w_var.R:40:3'
══ Failed tests ════════════════════════════════════════════════════════════════
── Error ('test-onLoad.R:99:3'): onLoad functions work ─────────────────────────
Error in `var(if (is.vector(x) || is.factor(x)) x else as.double(x), na.rm = na.rm)`: is.atomic(y) is not TRUE
Backtrace:
▆
1. ├─testthat::expect_length(sd(x), 1) at test-onLoad.R:99:2
2. │ └─testthat::quasi_label(enquo(object), arg = "object")
3. │ └─rlang::eval_bare(expr, quo_get_env(quo))
4. └─declared (local) sd(x)
5. └─declared (local) var(if (is.vector(x) || is.factor(x)) x else as.double(x), na.rm = na.rm)
6. └─base::stopifnot(is.atomic(y))
── Error ('test-w_mode.R:20:3'): w_mode() works ────────────────────────────────
Error: 'wt' should be an atomic vector with finite values.
Backtrace:
▆
1. ├─testthat::expect_message(w_mode(x[-1]), "Multiple modes detected") at test-w_mode.R:20:2
2. │ └─testthat:::expect_condition_matching(...)
3. │ └─testthat:::quasi_capture(...)
4. │ ├─testthat (local) .capture(...)
5. │ │ └─base::withCallingHandlers(...)
6. │ └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
7. └─declared::w_mode(x[-1])
8. └─declared:::stopError_("'wt' should be an atomic vector with finite values.")
── Error ('test-w_sd.R:9:3'): w_sd() works ─────────────────────────────────────
Error in `var(x, na.rm = na.rm)`: is.atomic(y) is not TRUE
Backtrace:
▆
1. ├─testthat::expect_equal(w_sd(x), sd(c(1:5, NA), na.rm = TRUE)) at test-w_sd.R:9:2
2. │ └─testthat::quasi_label(enquo(object), label, arg = "object")
3. │ └─rlang::eval_bare(expr, quo_get_env(quo))
4. └─declared::w_sd(x)
5. └─declared::w_var(x = x, wt = wt, method = method, na.rm = na.rm)
6. └─declared (local) var(x, na.rm = na.rm)
7. └─base::stopifnot(is.atomic(y))
── Error ('test-w_var.R:15:3'): w_var() works ──────────────────────────────────
Error in `var(x, na.rm = na.rm)`: is.atomic(y) is not TRUE
Backtrace:
▆
1. ├─testthat::expect_equal(w_var(x), var(c(1:5, NA), na.rm = TRUE)) at test-w_var.R:15:2
2. │ └─testthat::quasi_label(enquo(object), label, arg = "object")
3. │ └─rlang::eval_bare(expr, quo_get_env(quo))
4. └─declared::w_var(x)
5. └─declared (local) var(x, na.rm = na.rm)
6. └─base::stopifnot(is.atomic(y))
[ FAIL 4 | WARN 0 | SKIP 31 | PASS 437 ]
Error: Test failures
Execution halted
Flavor: r-devel-windows-x86_64
Current CRAN status: NOTE: 8, OK: 5
Version: 3.21
Check: installed package size
Result: NOTE
installed size is 5.8Mb
sub-directories of 1Mb or more:
gui 1.7Mb
staticdocs 3.4Mb
Flavors: r-devel-linux-x86_64-fedora-clang, r-devel-windows-x86_64, r-release-macos-arm64, r-release-macos-x86_64, r-release-windows-x86_64, r-oldrel-macos-arm64, r-oldrel-macos-x86_64, r-oldrel-windows-x86_64
Current CRAN status: OK: 13