- using R Under development (unstable) (2025-12-18 r89199)
- using platform: x86_64-pc-linux-gnu
- R was compiled by
Debian clang version 21.1.7 (1)
Debian flang version 21.1.7 (1)
- running under: Debian GNU/Linux forky/sid
- using session charset: UTF-8
- checking for file ‘bruceR/DESCRIPTION’ ... OK
- this is package ‘bruceR’ version ‘2025.11’
- package encoding: UTF-8
- checking CRAN incoming feasibility ... [2s/3s] OK
- checking package namespace information ... OK
- checking package dependencies ... OK
- checking if this is a source package ... OK
- checking if there is a namespace ... OK
- checking for executable files ... OK
- checking for hidden files and directories ... OK
- checking for portable file names ... OK
- checking for sufficient/correct file permissions ... OK
- checking whether package ‘bruceR’ can be installed ... OK
See the install log for details.
- checking package directory ... OK
- checking for future file timestamps ... OK
- checking DESCRIPTION meta-information ... OK
- checking top-level files ... OK
- checking for left-over files ... OK
- checking index information ... OK
- checking package subdirectories ... OK
- checking code files for non-ASCII characters ... OK
- checking R files for syntax errors ... OK
- checking whether the package can be loaded ... [15s/23s] OK
- checking whether the package can be loaded with stated dependencies ... [14s/17s] OK
- checking whether the package can be unloaded cleanly ... [14s/16s] OK
- checking whether the namespace can be loaded with stated dependencies ... [2s/2s] OK
- checking whether the namespace can be unloaded cleanly ... [2s/2s] OK
- checking loading without being on the library search path ... [6s/7s] OK
- checking whether startup messages can be suppressed ... [15s/21s] OK
- checking use of S3 registration ... OK
- checking dependencies in R code ... OK
- checking S3 generic/method consistency ... OK
- checking replacement functions ... OK
- checking foreign function calls ... OK
- checking R code for possible problems ... [25s/38s] OK
- checking Rd files ... [1s/1s] OK
- checking Rd metadata ... OK
- checking Rd line widths ... OK
- checking Rd cross-references ... OK
- checking for missing documentation entries ... OK
- checking for code/documentation mismatches ... OK
- checking Rd \usage sections ... OK
- checking Rd contents ... OK
- checking for unstated dependencies in examples ... OK
- checking contents of ‘data’ directory ... OK
- checking data for non-ASCII characters ... [0s/0s] OK
- checking LazyData ... OK
- checking data for ASCII and uncompressed saves ... OK
- checking examples ... [8s/11s] ERROR
Running examples in ‘bruceR-Ex.R’ failed
The error most likely occurred in:
> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: add
> ### Title: Create, modify, and delete variables.
> ### Aliases: add added
>
> ### ** Examples
>
> ## ====== Usage 1: add() ====== ##
>
> d = as.data.table(within.1)
> d$XYZ = 1:8
> d
ID A1 A2 A3 A4 XYZ
<char> <num> <num> <num> <num> <int>
1: S1 3 4 8 9 1
2: S2 6 6 9 8 2
3: S3 4 4 8 8 3
4: S4 3 2 7 7 4
5: S5 5 4 5 12 5
6: S6 7 5 6 13 6
7: S7 5 3 7 12 7
8: S8 2 3 6 11 8
>
> # add() does not change the raw data:
> add(d, {B = 1; C = 2})
ID A1 A2 A3 A4 XYZ B C
<char> <num> <num> <num> <num> <int> <num> <num>
1: S1 3 4 8 9 1 1 2
2: S2 6 6 9 8 2 1 2
3: S3 4 4 8 8 3 1 2
4: S4 3 2 7 7 4 1 2
5: S5 5 4 5 12 5 1 2
6: S6 7 5 6 13 6 1 2
7: S7 5 3 7 12 7 1 2
8: S8 2 3 6 11 8 1 2
> d
ID A1 A2 A3 A4 XYZ
<char> <num> <num> <num> <num> <int>
1: S1 3 4 8 9 1
2: S2 6 6 9 8 2
3: S3 4 4 8 8 3
4: S4 3 2 7 7 4
5: S5 5 4 5 12 5
6: S6 7 5 6 13 6
7: S7 5 3 7 12 7
8: S8 2 3 6 11 8
>
> # new data should be assigned to an object:
> d = d %>% add({
+ ID = str_extract(ID, "\\d") # modify a variable
+ XYZ = NULL # delete a variable
+ A = .mean("A", 1:4) # create a new variable
+ B = A * 4 # new variable is immediately available
+ C = 1 # never need ,/; at the end of any line
+ })
> d
ID A1 A2 A3 A4 A B C
<char> <num> <num> <num> <num> <num> <num> <num>
1: 1 3 4 8 9 6.00 24 1
2: 2 6 6 9 8 7.25 29 1
3: 3 4 4 8 8 6.00 24 1
4: 4 3 2 7 7 4.75 19 1
5: 5 5 4 5 12 6.50 26 1
6: 6 7 5 6 13 7.75 31 1
7: 7 5 3 7 12 6.75 27 1
8: 8 2 3 6 11 5.50 22 1
>
>
> ## ====== Usage 2: added() ====== ##
>
> d = as.data.table(within.1)
> d$XYZ = 1:8
> d
ID A1 A2 A3 A4 XYZ
<char> <num> <num> <num> <num> <int>
1: S1 3 4 8 9 1
2: S2 6 6 9 8 2
3: S3 4 4 8 8 3
4: S4 3 2 7 7 4
5: S5 5 4 5 12 5
6: S6 7 5 6 13 6
7: S7 5 3 7 12 7
8: S8 2 3 6 11 8
>
> # added() has already changed the raw data:
> added(d, {B = 1; C = 2})
> d
ID A1 A2 A3 A4 XYZ B C
<char> <num> <num> <num> <num> <int> <num> <num>
1: S1 3 4 8 9 1 1 2
2: S2 6 6 9 8 2 1 2
3: S3 4 4 8 8 3 1 2
4: S4 3 2 7 7 4 1 2
5: S5 5 4 5 12 5 1 2
6: S6 7 5 6 13 6 1 2
7: S7 5 3 7 12 7 1 2
8: S8 2 3 6 11 8 1 2
>
> # raw data has already become the new data:
> added(d, {
+ ID = str_extract(ID, "\\d")
+ XYZ = NULL
+ A = .mean("A", 1:4)
+ B = A * 4
+ C = 1
+ })
> d
ID A1 A2 A3 A4 B C A
<char> <num> <num> <num> <num> <num> <num> <num>
1: 1 3 4 8 9 24 1 6.00
2: 2 6 6 9 8 29 1 7.25
3: 3 4 4 8 8 24 1 6.00
4: 4 3 2 7 7 19 1 4.75
5: 5 5 4 5 12 26 1 6.50
6: 6 7 5 6 13 31 1 7.75
7: 7 5 3 7 12 27 1 6.75
8: 8 2 3 6 11 22 1 5.50
>
>
> ## ====== Using `when` and `by` ====== ##
>
> d = as.data.table(between.2)
> d
A B SCORE
<num> <num> <num>
1: 1 1 3
2: 1 1 6
3: 1 1 4
4: 1 1 3
5: 1 2 4
6: 1 2 6
7: 1 2 4
8: 1 2 2
9: 1 3 5
10: 1 3 7
11: 1 3 5
12: 1 3 2
13: 2 1 4
14: 2 1 5
15: 2 1 3
16: 2 1 3
17: 2 2 8
18: 2 2 9
19: 2 2 8
20: 2 2 7
21: 2 3 12
22: 2 3 13
23: 2 3 12
24: 2 3 11
A B SCORE
>
> added(d, {SCORE2 = SCORE - mean(SCORE)},
+ A == 1 & B %in% 1:2, # `when`: for what conditions
+ by=B) # `by`: by what groups
Error in `[.data.table`(data, A == 1 & B %in% 1:2, `:=`(SCORE2 = SCORE - :
attempt access index 3/3 in VECTOR_ELT
Calls: added -> eval -> eval -> [ -> [.data.table
Execution halted
- checking PDF version of manual ... [10s/15s] OK
- checking HTML version of manual ... [8s/12s] OK
- checking for non-standard things in the check directory ... OK
- DONE
Status: 1 ERROR