Skip to content

droplevels on Factor produces warning #125

Description

@MalteThodberg

The new raw-based Factors are great!

However, the droplevels method produces a warning. Here's an example using the man page for Factor:

library(IRanges)
set.seed(123)
ir0 <- IRanges(sample(5, 8, replace=TRUE), width=10,
               names=letters[1:8], ID=paste0("ID", 1:8))

## Use explicit levels:
ir1 <- IRanges(1:6, width=10)
F1 <- Factor(ir0, levels=ir1)
droplevels(F1)

Gives the warning:

Warning message:
In storage.mode(index) <- "raw" :
  out-of-range values treated as 0 in coercion to raw

Session info for reference:

R version 4.4.1 (2024-06-14)
Platform: aarch64-apple-darwin20
Running under: macOS Sonoma 14.5

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.12.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: Europe/Copenhagen
tzcode source: internal

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

other attached packages:
[1] IRanges_2.38.1      S4Vectors_0.42.1    BiocGenerics_0.50.0

loaded via a namespace (and not attached):
[1] BiocManager_1.30.23 compiler_4.4.1      cli_3.6.3           tools_4.4.1        
[5] rstudioapi_0.16.0   pkgload_1.4.0       rlang_1.1.4

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions