r-lib/crayon

make_style(col2rgb("red")): error on 'length(x) = 3 > 1' in coercion to 'logical(1)'

HenrikBengtsson opened this issue · 0 comments

There's a _R_CHECK_LENGTH_1_LOGIC2_ bug in make_style();

> crayon::make_style(col2rgb("red"))
Crayon style function, : example output.

> Sys.setenv("_R_CHECK_LENGTH_1_LOGIC2_" = "verbose")
> crayon::make_style(col2rgb("red"))
 ----------- FAILURE REPORT -------------- 
 --- failure: length > 1 in coercion to logical ---
 --- srcref --- 
: 
 --- package (from environment) --- 
crayon
 --- call from context --- 
is_r_color(style)
 --- call from argument --- 
x %in% colors() || grepl(hash_color_regex, x)
 --- R stacktrace ---
where 1: is_r_color(style)
where 2: crayon::make_style(col2rgb("red"))

 --- value of length: 3 type: logical ---
[1] FALSE FALSE FALSE
 --- function from context --- 
function (x) 
{
    x %in% colors() || grepl(hash_color_regex, x)
}
<bytecode: 0x55c456efd808>
<environment: namespace:crayon>
 --- function search by body ---
Function is_r_color in namespace crayon has this body.
 ----------- END OF FAILURE REPORT -------------- 
Error in x %in% colors() || grepl(hash_color_regex, x) : 
  'length(x) = 3 > 1' in coercion to 'logical(1)'
> sessionInfo()
R version 4.0.4 (2021-02-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.5 LTS

Matrix products: default
BLAS:   /home/hb/shared/software/CBI/R-4.0.4/lib/R/lib/libRblas.so
LAPACK: /home/hb/shared/software/CBI/R-4.0.4/lib/R/lib/libRlapack.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_4.0.4  tools_4.0.4     rstudioapi_0.13 crayon_1.4.1